Vscode Golang Environment Setup (Mac OS)

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
    1. Installation Golang (slightly)
    2. Install vs Code (slightly)
    3. Setting environment variables (source ~/.bash_profile)
export GOROOT='/usr/local/go'export GOARCH='amd64'export GOOS='darwin'export GOPATH='/Users/your_name/gopath'export PATH='/bin:/sbin:/usr/bin:/usr/local/bin:/usr/local/go/bin'

4. Vscode installation extension (slightly)

5. Execute the following script (make sure the environment variable takes effect before executing the script source ~/.bash_profile)

#!/bin/bashbasedir= "$GOPATH/src/golang.org/x" echo "BASEDIR >> $BASEDIR" if [!-D $BASEDIR];then mkdir-p $BA Sedir echo "Create $BASEDIR" Ficd $BASEDIRif [!-d "$BASEDIR/tools"];then git clone Https://github.com/gola Ng/toolselse cd $BASEDIR/tools git pullfigo install golang.org/x/tools/cmd/gurugo install Golang.org/x/tools /cmd/guru/serialgo Install Golang.org/x/tools/cmd/gorenamego install Golang.org/x/tools/cmd/goimportsgo Install Golang.org/x/tools/go/loadergo Install Golang.org/x/tools/go/buildutilgo Install golang.org/x/tools/go/ast/ Astutilgo Install Golang.org/x/tools/go/gcexportdatago install golang.org/x/tools/go/gcimporter15go Install Golang.org/x/tools/go/ast/astutilgo Install Golang.org/x/tools/go/types/typeutilgo Install golang.org/x/tools/ Refactor/satisfygo Install Golang.org/x/tools/refactor/renamego Install Golang.org/x/tools/refactor/importgraphgo Install Golang.org/x/tools/importsgo get-v github.com/nsf/gocodego get-v GITHUB.COm/rogpeppe/godefgo get-v Github.com/golang/lint/golintgo get-v github.com/lukehoban/go-outlinego get-v Sourcegraph.com/sqs/goreturnsgo get-v golang.org/x/tools/cmd/gorenamego get-v github.com/tpng/gopkgsgo get-v Github.com/newhook/go-symbolsgo get-v Golang.org/x/tools/cmd/guru

    6. Open Vscode, start go! Go! Go! Bar

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.