Linux configuration method: Four environment variables need to be set: goroot, gopath, Gobin, and path. You need to set them to a profile file (~ /. Bash_profile (Single User) or/etc/Profile (all users) goroot: The environment variable value should be the current installation directory of the Go language, for example:ExportGoroot =/usr/local/Gogopath: The environment variable value should be a set of work zones in the go language, for example:ExportGopath = ~ /Golib :~ /Goproject (~Is in the middle) Gobin: its value should be the directory where you want to store the executable files of the Go program, for example:ExportGobin = ~ /Gobinpath: to facilitate the use of the Go language command and the executable file of the Go program, you need to append its value, such:ExportPath = $ path: $ goroot/Bin: $ Gobin append the setup code for these environment variables to a profile file. Make the Code take effect immediately after editing the profile file: Source<Absolute path of a profile File>Verification setting result: Enter go version in any directory under the command line, press enter, and check the print information.
View code
Set Go Environment Variables