Golang Debug with Liteide

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Golang debugging is troublesome, debug stop into cannot jump to the code you write, but can jump to the system-provided code.

The following is a simple test code:


Package Main

Import (
"FMT"
)

Func Main () {
I: = 5
Even (i)
B: = 1
Fmt. Printf ("is%d even?" %v\n ", I, B)
}

Func even (i int) bool {
A: = 1
B: = a + 1
b = B + 1
return i%2 = = 0
}

The situation is so bizarre that the Golang gdb is everywhere on the internet. See here for details:


Http://grokbase.com/t/gg/golang-nuts/1443r0vch8/go-nuts-debugging-in-go-seems-to-be-a-very-difficult-task-to-accomplish

But at the end of the liteide, someone provided a way to set it inside.

1-open your project in Liteide2-select "Build" menu and under it select "Build Configuration ..." 3-a dialog shows up. Select "Custom" tab.  It contains a list of key/valuepairs4-double click the space reserved for the value of "Buildargs" 5-write-gcflags "-N  -L "6-close the dialog by clicking Ok button7-rebuild your project (ctrl+b) 8-press F5 to start debugging9-put some Breakpoints wherever wish10-press F5 again to reach the first breakpoint

Solution:

1-Open Liteide Build Settings 2-Modify Buildargs variable, add parameter-gcflags "-n-l" Note there is a quotation mark 3-Save it now 4-enjoy it
Related Article

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.