五行命令安装Go语言环境

用五行命令安装Go语言环境    这里以我一台Centos8 64bit为例 ,先ssh登录到linux服务器  ,打入红色部分几行命令即可,直接复制操作记录如下:

图片[1]-五行命令安装Go语言环境 - 世外博客-世外博客

Last login: Thu Dec 30 00:58:45 2021 from 127.0.0.1
[root@vps ~]# wget https://golang.google.cn/dl/go1.17.5.linux-amd64.tar.gz 
–2021-12-30 21:42:18– https://golang.google.cn/dl/go1.17.5.linux-amd64.tar.gz
Resolving golang.google.cn (golang.google.cn)… 142.250.72.163, 2607:f8b0:4007:815::2003
Connecting to golang.google.cn (golang.google.cn)|142.250.72.163|:443… connected.
HTTP request sent, awaiting response… 302 Found
Location: https://dl.google.com/go/go1.17.5.linux-amd64.tar.gz [following]
–2021-12-30 21:42:18– https://dl.google.com/go/go1.17.5.linux-amd64.tar.gz
Resolving dl.google.com (dl.google.com)… 142.250.217.142, 2607:f8b0:4007:818::200e
Connecting to dl.google.com (dl.google.com)|142.250.217.142|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 134808667 (129M) [application/x-gzip]
Saving to: ‘go1.17.5.linux-amd64.tar.gz’

go1.17.5.linux-amd64.tar.gz 100%[==========================================================================>] 128.56M 4.97MB/s in 26s

2021-12-30 21:42:44 (4.97 MB/s) – ‘go1.17.5.linux-amd64.tar.gz’ saved [134808667/134808667]

[root@vps ~]# tar -C /usr/local -xzf go1.17.5.linux-amd64.tar.gz

[root@vps ~]# vi ~/.bash_profile   (把export PATH=$PATH:/usr/local/go/bin 添加到文尾 :wq 保存退出)

[root@vps ~]# source ~/.bash_profile

[root@vps ~]# go
Go is a tool for managing Go source code.

Usage:

go <command> [arguments]

The commands are:

bug start a bug report
build compile packages and dependencies
clean remove object files and cached files
doc show documentation for package or symbol
env print Go environment information
fix update packages to use new APIs
fmt gofmt (reformat) package sources
generate generate Go files by processing source
get add dependencies to current module and install them
install compile and install packages and dependencies
list list packages or modules
mod module maintenance
run compile and run Go program
test test packages
tool run specified go tool
version print Go version
vet report likely mistakes in packages

Use “go help <command>” for more information about a command.

Additional help topics:

buildconstraint build constraints
buildmode build modes
c calling between Go and C
cache build and test caching
environment environment variables
filetype file types
go.mod the go.mod file
gopath GOPATH environment variable
gopath-get legacy GOPATH go get
goproxy module proxy protocol
importpath import path syntax
modules modules, module versions, and more
module-get module-aware go get
module-auth module authentication using go.sum
packages package lists and patterns
private configuration for downloading non-public code
testflag testing flags
testfunc testing functions
vcs controlling version control with GOVCS

Use “go help <topic>” for more information about that topic.

五行命令安装Go语言环境就完成了,下次来讲如何运行一个go语言网站。

图片[2]-五行命令安装Go语言环境 - 世外博客-世外博客

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享
评论 抢沙发

请登录后发表评论