jenkins k8s 编译 golang 遇到 vendor 的坑

将当前项目 link 到 /go/src/github.com/project,将 vendor 复制到 /go/src/

1
2
3
4
5
6
7
8
9
10
11
12
stage("go build") {
steps {
container("golang") {
sh """
cp vendor/* /go/src/ -rf
mkdir -p /go/src/github.com/project
ln -s `pwd` /go/sr/github.com/project
cd /go/src/github.com/project && go build
"""
}
}
}

参考链接: