From e4cdb0eab3ffa88d06b05c8f5b5ee4f8437ab8b4 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 30 Aug 2018 23:10:54 +0200 Subject: [PATCH] Travis: Run with -mod=vendor only for Go >= 1.11 --- run_integration_tests.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/run_integration_tests.go b/run_integration_tests.go index 43ae9d689..364f501cb 100644 --- a/run_integration_tests.go +++ b/run_integration_tests.go @@ -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