2016 latest Mac under Vscode configuration Golang development Environment Support DEBUG

Source: Internet
Author: User
Tags install go

Online currently can not find a complete Mac under the Golang environment configuration support, I configured the success, now collated to share out.

Mac better install Xcode, as if it had dependencies
Installing homebrew
Open terminal window, paste script execution
/usr/bin/ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install the latest version of the Go language, to the official website https://golang.org/dl/download, need to hang science online recommended a 58jiasu.com now has a monthly activity of 2 yuan

Install Vscode, Baidu opened the official website installed on the line Https://code.visualstudio.com/download

After loading, open the left vertical row of icons, point fifth icon

Open the extension function, search go here also to hang science online

Install Lukehoban Author's go plugin I installed it in the second

Start configuring environment variables for your Mac now
Open terminal set up working directory
CD $HOME

mkdir work
Adding environment variables
Vim ~/.bash_profile
Join

Export Gopath= $HOME/go

Export path= $HOME/bin: $GOPATH/bin: $PATH
Save exit: Wq
SOURCE ~/.bash_profile
Effective immediately

Then install IDE support
Go get-u-v github.com/nsf/gocode
Go get-u-v github.com/rogpeppe/godef
Go get-u-v github.com/golang/lint/golint
Go get-u-v github.com/lukehoban/go-find-references
Go get-u-v github.com/lukehoban/go-outline
Go get-u-v sourcegraph.com/sqs/goreturns
Go get-u-v golang.org/x/tools/cmd/gorename
Go get-u-v github.com/tpng/gopkgs
Go get-u-v github.com/newhook/go-symbols
These are performed at the terminal input
We can't debug this time.
Installing debug Support
Go get-v-u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
I use the latest version of the installation after the problem, need to deal with the following
Brew Install Go-delve/delve/delve
And then I'll do it again.
Go get-v-u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
It's almost done now.

Finally we start the debug plugin
Follow these steps strictly:

1> "Keychain Access" open
2> Open Menu Keychain Access/Certificate Assistant/Create Certificate ...
3> Name: Dlv-cert identity Type: Self-signed certificate certificate type: Code signing and select "Let me override these defaults"
4> Click "Continue", validity period (days): 365 Here you can modify yourself, I changed to 3650
5> go all the way until you see the "Specify a location for this certificate" keychain select System and click the Create button
6> Restart the system, then open keychain Access, select System, you will see the created "Dlv-cert" certificate.
7> Right-click the "Dlv-cert" certificate, select "Show Info", "trust", "code signing" modified to: Always trust
8> Open terminal and then CD command to enter the "Gopath/src directory under the DLV source file directory: Github.com/derekparker/delve" before you install
9> Enter the following command: go15vendorexperiment=1 cert=dlv-cert make install so that you can recompile a DLV execution program with code signing

Restart the computer, you can play happily

Finally, it is necessary to remind the need for full scientific Internet Referral 58jiasu.com Now there are activities very cheap as long as 2 yuan monthly

2016 latest Mac under Vscode configuration Golang development Environment Support 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.