我们在一个项目中使用了 go modules 和 travis。每次 Travis 构建项目时,go modules 都会获取所有依赖项,这会增加构建时间。有什么方法可以减少该时间或避免每次都获取部门?
最佳答案
是的,您可以缓存 Go 模块以加快构建过程。
- language: go
script:
- your script
cache:
directories:
- $HOME/.cache/go-build # Cache the binaries
- $HOME/gopath/pkg/mod # Cache the Go modules
关于go - 使用模块时如何让 Travis 更快地构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56431539/