Ubuntu Configuration Vscode Golang Environment

Source: Internet
Author: User
Tags git clone

Today configuration environment to get a half day, the reason is Golang official website was wall, unable to download package.

1. Installing Golang

1). Download on official website
2). Unzip and move to /usr/localin the download directory, tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
3). Add environment Variables in ~/.BASHRC

 export GOROOT=/usr/local/go export GOPATH=$HOME/go export PATH=$PATH:$GOROOT/bin:GOPATH

4). After completing the environment settings, use the source ~./bashrc environment variable to take effect, then restart the terminal input to go see if it is successful.

2. Configuring the Vscode Environment

1). Install the Go plugin
2). Build A. Go file in src/, and then Vscode automatically prompts you to install the plugin

Installation Results

At this point there will be 6 package installation errors, see log Discovery download from golang.org download tool caused.

3). Execution

mkdir $GOPATH/src/golang.org/x -p
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/tools

    • Guru

      cd $GOPATH/src/golang.org/x/tools/cmd/guru
      go install

    • Gorename

      cd $GOPATH/src/golang.org/x/tools/cmd/gorename
      go install

    • Goreturns

      cd $GOPATH/src/github.com/sqs/goreturns
      go install

    • Golint

      cd $GOPATH/src/github.com/golang/lint
      go install

    • Go-outline

      cd $GOPATH/src/github.com/ramya-rao-a/go-outline
      go install

    • Go-symbols

      cd $GOPATH/src/github.com/acroca/go-symbols
      go install

It's done!

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.