steps:- name:testingimage:golang:1.11pull:trueenvironment:GO111MODULE:oncommands:- make vet- make lint- make misspell-check- make fmt-check- make build_linux_amd64- make test
結論
在開源專案內為了相容 Go 舊版本,所以 Gin 同時支援了 govendor 及 go module,其實還蠻難維護的,但是可以透過 travis 環境變數的判斷來達成目的:
language:gosudo:falsego:- 1.6.x- 1.7.x- 1.8.x- 1.9.x- 1.10.x- 1.11.x- mastermatrix:fast_finish:trueinclude:- go:1.11.xenv:GO111MODULE=ongit:depth:10before_install:- if [[ "${GO111MODULE}" = "on" ]]; then mkdir "${HOME}/go"; export GOPATH="${HOME}/go"; fiinstall:- if [[ "${GO111MODULE}" = "on" ]]; then go mod download; else make install; fi- if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi- if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi