With the development of golang, more and more developers are beginning to use this language for development. Golang 1.10 is an important version of the language. It adds many important new features, such as support for function literals, enhanced testing support, etc.
In this article, we will introduce the detailed steps on how to install golang 1.10 and above.
Before installing golang, you need to meet the following requirements:
If gcc and make are not installed on your operating system, you can install them through the package manager.
Fedora/CentOS/RHEL:
sudo yum install gcc sudo yum install make
Debian/Ubuntu:
sudo apt-get install gcc sudo apt-get install make
You can download golang from the official website https ://golang.org/dl/ Download the golang binaries for your operating system.
Here, we will choose to download the binary file of golang 1.10.3 version. Please select and download the latest version here based on your operating system and architecture.
sudo mkdir /usr/local/go
sudo tar -C /usr/local -xzf go1.10.3.linux-amd64.tar.gz
Add the following content to the ~/.bash_profile
file:
export PATH=$PATH:/usr/local/go/bin export GOPATH=$HOME/go
here We set GOPATH to $HOME/go
, you can set it to other directories as needed.
source ~/.bash_profile
By running the go version
command, you can see that golang has been installed and successfully configured.
Create a simple helloworld.go file:
package main import "fmt" func main() { fmt.Println("Hello, World!") }
Run the following command:
go run helloworld.go
The output should be:
Hello, World!
At this point, you have successfully installed and configured golang 1.10, and you can now start using it for golang development.
Conclusion
The above are the installation steps of golang 1.10. If you are not familiar with golang yet, you can consult relevant literature and learning materials to learn more about golang so that you can better use the language for development.
The above is the detailed content of golang 1.10 installation. For more information, please follow other related articles on the PHP Chinese website!