[Golang Learning] in idea code & DEBUG

Source: Internet
Author: User

idea, although aesthetic backwards for n years. But the function is quite useful.

Idea's Go plugin is the best go IDE.

1. Syntax highlighting support

2. Smart Tips

3. Jump definition (Reverse jump back)

4. Integrated debugger

There are also refactoring and so on functions are also good.

These are all features that are very comfortable to use. If you use Vim/emacs/sublime or anything. When I didn't say.

Many people may not know that the Golang code can be debug. Many people use the console GDB command-style debugging. If you don't need an interface debugger, you can skip it.

1. Syntax highlighting support

The colors look very rubbing. The default, I also too lazy to change. We can change it casually.

2. Smart Tips

Although I think the VS + VA hint is a bit more hanging. But it's also good.

3. Jump definition (Reverse jump back)

This is useful when looking at the code.

For example I jump to FMT. The Declaration of print. I also want to jump back. You can back up and then continue with code.

4. Integrated debugger

This is the highlight. First, two graphs.

can be very convenient to delete breakpoints.

Can be single-step debugging and so on.

There are three windows in the Debugger tab below

Frames window: View Stack stack

Variables window: View variables, as you can see, supports displaying complex variables. such as []byte string struct and so on.

Watch window: Watch variables

This is the GDB command window. Manually enter the GDB command directly. Oh. Just like the console gdb.

and refactoring or something. are based on idea. The experience is also good.

Well, the effect can be achieved all looked. Here's how to achieve these effects.

1. Install the idea and go plugin

Download the latest community version of idea from here https://www.jetbrains.com/idea/.

Download the latest version of Golang plugin from here https://github.com/go-lang-plugin-org/go-lang-idea-plugin/releases.

You can also install directly from idea's plugin repository. But that version is rather old. Go 1.4 is not supported. The plugin author has not released the release of the fix release. Therefore, it is recommended to use the Alpha version directly.

After you open idea, select Configure-Plugins, and then select Install plugin from disk. Select the jar package for the Golang plugin you just downloaded. Can.

2. Configure Golang

Open Project Structure, configure, Project Default. Configure the SDK for Golang here.

3. Debug Golang

Select menu Run, edit configurations to open the Run/debug configurations window.

There seems to be a small problem here. If enable debugging cannot be checked. Tick/uncheck build before run first. Then tick enable debugging.

Attention. The Enable debugging must be checked. Otherwise, you cannot debug.

Then switch to the Debug tab.

GDB can be copied from Mingw/liteide/zesu and so on. The required version should be more than 7.1.

The gdb.exe corresponds to a 32-bit system.

Gdb64.exe for 64-bit systems.

Can not be mixed with. Otherwise, the EXE format is not recognized.

Finally, run, Debug "test". The year began commissioning.

[Golang Learning] in idea code & DEBUG

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.