Go locale installation-mac

Source: Internet
Author: User
Tags locale using git

1. Installation of the environment

Go SDK Download and install for: https://golang.org/dl/
Visual Studio Code downloads and installs as: Https://code.visualstudio.com/Download
Everyone according to different operating system selection, installation is relatively simple, basically the next step is completed
After the installation is complete, you can view the version of Go command: Go version

View the GO Environment configuration information command: Go env

2. Tool configuration 2.1go plug-in installation
    输入关键字“go”,回车查询,选择第一个,点击安装即可。

2.2VS Code Configuration

Open Visual Studio Code and find the menu code->preferences->settings

{    "go.autocompleteUnimportedPackages": true,    "files.autoSave": "onFocusChange",    "go.buildOnSave": "package",    "go.lintOnSave": "package",    "go.vetOnSave": "package",    "go.buildFlags": [],    "go.lintFlags": [],    "go.vetFlags": [],    "go.useCodeSnippetsOnFunctionSuggest": false,    "go.formatTool": "goreturns",    "go.gopath": "/Users/[username]/go",    "go.goroot": "/usr/local/go",}
2.3 Plugin Folder Configuration

Create a new Folder "Golang.org" in the Gopath corresponding directory, in the Golang.org folder in the new folder "X",
Open the command-line tool and run the following command:

    • Switch current directory to X:CD $GOPATH/src/golang.org/x/
    • Download tools tools: Git clone https://github.com/golang/tools.git Tools
2.4 Installing Plugins

Create a new Demo project folder under GOPATH->SRC, such as Demo1, create a new file Demo.go under Demo1, and open the folder with VS code, such as:
Vscode will automatically prompt to install the plug-in package, the bottom right corner of the figure, click "Install all" to install all plugins

If a package that cannot be downloaded can be downloaded using git clone, the download is completed and copied to the corresponding directory:
如:git clone https://github.com/cweill/gotests

2.5 Installing Xcode-select

Run the following command:
xcode-select --install

2.6 Installing Delve

Switch to the path first:
cd /Users/[username]/go/bin
Run the following command to install the plugin delve
go get -u github.com/derekparker/delve/cmd/dlv

2.7 Plugin Introduction
    1. Colorization code with color?
    2. Completion Lists Code Auto-complete (using Gocode)
    3. Snippets Code Snippets?
    4. Quick Info Prompt information (using godef)?
    5. Goto definition jumps to definitions (using Godef)?
    6. Find References Search reference (using go-find-references)?
    7. File Outline Document Outline (using Go-outline)?
    8. Workspace symbol Search Workspace sign searching (using Go-symbols)?
    9. Rename renaming (using Gorename)?
    10. Build-on-save Save build (using Go build or go test)?
    11. Format formatted (using Goreturns or Goimports or gofmt)?
    12. ADD Imports Auto-complete import of packages not imported (using gopkgs)?
    13. Linter Static analysis Check (using Golint or Gometalinter)?
    14. Debugging debug code (using delve)?
    15. errorchecking check for unchecked errors in your code (using Errcheck)?
    16. Varchecking find global variables and constants that are not called (using Varcheck)?
    17. Unusedcode find code that is not called (using Deadcode)

Go locale installation-mac

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.