Sudo apt-Get install golang
Gccgo Installation
View gcc-V
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
If your GCC supports golang, run the following command to install gcc-Go (I am not sure if you try this command ):
sudo apt-get install gccgo
Set system environment variables
Sudo gedit/etc/profile
Export goroot =/usr/lib/go # Note: some articles on the Internet are stored in/usr/local/go.
Export Gobin = $ goroot/bin
Export gopkg = $ goroot/PKG/tool/linux_amd64
Export goarch = amd64
Export GOOS = Linux
Export Path =.: $ path: $ Gobin: $ gopkg
Compile and make it take effect
Source/etc/profile
Test
If you can see the version number, the configuration is successful!
Go version
Go version go1.2.1 Linux/amd64
Write the test code and save it as hello. Go.
package mainimport "fmt"func main() {fmt.Printf("hello, world\n")}
Go run Hello. Go
Run
Successful!