2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-29 16:23:59 +00:00

Travis: Run with -mod=vendor only for Go >= 1.11

This commit is contained in:
Alexander Neumann 2018-08-30 23:10:54 +02:00
parent e9a764129f
commit e4cdb0eab3

View File

@ -330,8 +330,15 @@ func (env *TravisEnvironment) RunTests() error {
} }
} }
args := []string{"go", "run", "build.go"}
v := ParseGoVersion(runtime.Version())
msg("Detected Go version %v\n", v)
if v.AtLeast(GoVersion{1, 11, 0}) {
args = []string{"go", "run", "-mod=vendor", "build.go"}
}
// run the build script // run the build script
if err := run("go", "run", "-mod=vendor", "build.go"); err != nil { if err := run(args[0], args[1:]...); err != nil {
return err return err
} }
@ -342,8 +349,6 @@ func (env *TravisEnvironment) RunTests() error {
} }
// only run gofmt on a specific version of Go. // only run gofmt on a specific version of Go.
v := ParseGoVersion(runtime.Version())
msg("Detected Go version %v\n", v)
if v.AtLeast(GofmtVersion) { if v.AtLeast(GofmtVersion) {
if err = runGofmt(); err != nil { if err = runGofmt(); err != nil {
return err return err