Golang常用命令
# 环境变量
# go env 写环境变量 -w 可以直接写
go env -w GO111MODULE=on
# go bin (mac 默认安装)
/Users/gaozhe/go/bin/darwin_amd64/buf
1
2
3
4
5
2
3
4
5
# 私有库
# 私有库
export GOPRIVATE="git.hongyuan.com/crawler
git config --global url."git@hongyuan.com:".insteadof "https://git.hongyuan.com/"
git config --global url."ssh://git@git.hongyuan.com".insteadOf "https://git.hongyuan.com/"
go get git.hongyuan.com/crawler/GoCrawler
1
2
3
4
5
2
3
4
5
# 下载
# 指定版本号
# 指定下载commit id
go get github.com/fatedier/golib@c306138b83ac3405ef7edd65b8b346d2a0b74737
1
2
3
2
3
# replace
# 该方法在本地开发第三方包时很有用
replace (
git.hongyuan.com/spider/GoCrawler => /Users/xxx/GolandProjects/biyao/GoCrawler
)
require (
git.hongyuan.com/spider/GoCrawler v0.0.0-20230730062917-1298609de695
)
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 版本冲突
replace (
go.opentelemetry.io/otel/trace => go.opentelemetry.io/otel/trace v1.10.0
google.golang.org/grpc => google.golang.org/grpc v1.29.1
)
1
2
3
4
2
3
4
上次更新: 2023-08-03 09:16:09