Get the App
SLTechnology News&Howtos  ›  Development  › 

How to configure Go locale for Vs code under Mac

Shulou Source: shulou.com Published: 2022-05-31 22:24:49 09月21日 Update

This article introduces the relevant knowledge of "How to configure Go language environment under Mac Vs code". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

I. Go Download and Install

Mac version select pkg, download can be installed directly.

II. Verification Version

Command line:

go version

Display the installed version and you are officially done

III. Vs code configuration Go environment

1. Go Development Extension

Search Go directly in Vs code extension and install it.

2. Go tool in VS code

Vs code Open input: Command+Shift+P, in the pop-up box input: Go:install/update Tools, select all tools, install. The output window displays the following: (Personal 10 tools are not installed successfully)

Tools environment: GOPATH=/Users/luck/go

Installing 10 tools at /Users/luck/go/bin in module mode.

gopkgs

go-outline

gotests

gomodifytags

impl

goplay

dlv

dlv-dap

staticcheck

gopls

Appears: Installing github.com/josharian/impl FAILED etc.

Workaround-Set proxy:

Go 1.13 and above (recommended)

Open your terminal and execute

$ go env -w GO111MODULE=on

$ go env -w GOPROXY=https://goproxy.cn,direct

Done.

macOS or Linux

Open your terminal and execute

$ export GO111MODULE=on

$ export GOPROXY=https://goproxy.cn

or

$ echo "export GO111MODULE=on" >> ~/.profile

$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile

$ source ~/.profile

"Mac Vs code how to configure the Go language environment" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Tags: Environment configuration tools language content situation more version knowledge terminal input output utility success achievement next individual command dilemma reality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Huawei Xiaomi Apple macOS