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
1 changed files with 8 additions and 3 deletions

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
if err := run("go", "run", "-mod=vendor", "build.go"); err != nil {
if err := run(args[0], args[1:]...); err != nil {
return err
}
@ -342,8 +349,6 @@ func (env *TravisEnvironment) RunTests() error {
}
// 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 err = runGofmt(); err != nil {
return err