Jenkins部署Golang
编译环境:
1.安装go语言
2.优化测试
部署环境:
1.部署
第一步:编译环境(Jenkins)
1.安装golang语言
#1.下载golang
[root@jenkins opt]# wget https://golang.google.cn/dl/go1.16.3.linux-amd64.tar.gz
#2.安装
[root@jenkins opt]# tar -xf go1.16.3.linux-amd64.tar.gz -C /usr/local/
#3.添加环境变量
[root@jenkins opt]# vim /etc/profile
export GO_HOME=/usr/local/go
export GO_ROOT=/usr/local/go
export GO_PATH=/opt/go
export GOPROXY=https://mirrors.aliyun.com/goproxy/
PATH=$PATH:$GO_HOME:$GO_ROOT:$GO_PATH:$GO_HOME/bin
export PATH
[root@jenkins opt]# source /etc/profile
[root@jenkins opt]# printenv |grep GO
GO_PATH=/opt/go
GOPROXY=https://mirrors.aliyun.com/goproxy/
GO_HOME=/usr/local/go
GO_ROOT=/usr/local/go
2.测试
[root@jenkins opt]# mkdir /opt/go
[root@jenkins opt]# cd !$
cd /opt/go
[root@jenkins go]# go mod init jenkins-go #创建一个go.mod文件
go: creating new go.mod: module jenkins-go
[</