From 1293a5f6ee4774091e1bfa455d4f01ca6e44fddc Mon Sep 17 00:00:00 2001 From: Andrew Wilkins Date: Wed, 4 Sep 2019 19:01:18 +0800 Subject: [PATCH] Update genmod - add GOSUMDB - add "go " to temporary go.mod for diff - refreshes all of the go.mod's indirectly --- go.mod | 2 ++ internal/tracecontexttest/go.mod | 2 ++ module/apmbeego/go.mod | 2 ++ module/apmchi/go.mod | 2 ++ module/apmecho/go.mod | 2 ++ module/apmechov4/go.mod | 2 ++ module/apmelasticsearch/go.mod | 2 ++ .../apmelasticsearch/internal/integration/go.mod | 2 ++ module/apmgin/go.mod | 2 ++ module/apmgocql/go.mod | 2 ++ module/apmgokit/go.mod | 2 ++ module/apmgometrics/go.mod | 2 ++ module/apmgopg/go.mod | 2 ++ module/apmgorilla/go.mod | 2 ++ module/apmgorm/go.mod | 2 ++ module/apmgrpc/go.mod | 2 ++ module/apmhttp/go.mod | 2 ++ module/apmhttprouter/go.mod | 2 ++ module/apmlambda/go.mod | 2 ++ module/apmlogrus/go.mod | 2 ++ module/apmmongo/go.mod | 2 ++ module/apmot/go.mod | 2 ++ module/apmprometheus/go.mod | 2 ++ module/apmredigo/go.mod | 2 ++ module/apmrestful/go.mod | 2 ++ module/apmsql/go.mod | 2 ++ module/apmzap/go.mod | 2 ++ module/apmzerolog/go.mod | 2 ++ scripts/genmod/go.mod | 2 ++ scripts/genmod/main.go | 14 +++++++++----- 30 files changed, 67 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 77b39b82b..d54d86d32 100644 --- a/go.mod +++ b/go.mod @@ -12,3 +12,5 @@ require ( go.elastic.co/fastjson v1.0.0 golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e ) + +go 1.13 diff --git a/internal/tracecontexttest/go.mod b/internal/tracecontexttest/go.mod index 12d179697..fa1032113 100644 --- a/internal/tracecontexttest/go.mod +++ b/internal/tracecontexttest/go.mod @@ -5,3 +5,5 @@ require go.elastic.co/apm/module/apmhttp v1.5.0 replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../../module/apmhttp + +go 1.13 diff --git a/module/apmbeego/go.mod b/module/apmbeego/go.mod index 75c47a704..06807dc04 100644 --- a/module/apmbeego/go.mod +++ b/module/apmbeego/go.mod @@ -14,3 +14,5 @@ replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp replace go.elastic.co/apm/module/apmsql => ../apmsql + +go 1.13 diff --git a/module/apmchi/go.mod b/module/apmchi/go.mod index b2ba92883..c5c8239d5 100644 --- a/module/apmchi/go.mod +++ b/module/apmchi/go.mod @@ -10,3 +10,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmecho/go.mod b/module/apmecho/go.mod index 073e25700..dd9145710 100644 --- a/module/apmecho/go.mod +++ b/module/apmecho/go.mod @@ -17,3 +17,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmechov4/go.mod b/module/apmechov4/go.mod index 6edbc57bb..3ddf78ef6 100644 --- a/module/apmechov4/go.mod +++ b/module/apmechov4/go.mod @@ -12,3 +12,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmelasticsearch/go.mod b/module/apmelasticsearch/go.mod index 6589db470..366fb7851 100644 --- a/module/apmelasticsearch/go.mod +++ b/module/apmelasticsearch/go.mod @@ -10,3 +10,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmelasticsearch/internal/integration/go.mod b/module/apmelasticsearch/internal/integration/go.mod index db29c870c..529bfdae0 100644 --- a/module/apmelasticsearch/internal/integration/go.mod +++ b/module/apmelasticsearch/internal/integration/go.mod @@ -14,3 +14,5 @@ replace go.elastic.co/apm => ../../../.. replace go.elastic.co/apm/module/apmelasticsearch => ../.. replace go.elastic.co/apm/module/apmhttp => ../../../apmhttp + +go 1.13 diff --git a/module/apmgin/go.mod b/module/apmgin/go.mod index 7ef0dff60..1fb1e6148 100644 --- a/module/apmgin/go.mod +++ b/module/apmgin/go.mod @@ -11,3 +11,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmgocql/go.mod b/module/apmgocql/go.mod index ffb574f75..75fff3757 100644 --- a/module/apmgocql/go.mod +++ b/module/apmgocql/go.mod @@ -9,3 +9,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/module/apmgokit/go.mod b/module/apmgokit/go.mod index 1ca20e726..9858a5d31 100644 --- a/module/apmgokit/go.mod +++ b/module/apmgokit/go.mod @@ -18,3 +18,5 @@ replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmgrpc => ../apmgrpc replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmgometrics/go.mod b/module/apmgometrics/go.mod index 2bcdbf6e1..17f581b5c 100644 --- a/module/apmgometrics/go.mod +++ b/module/apmgometrics/go.mod @@ -7,3 +7,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/module/apmgopg/go.mod b/module/apmgopg/go.mod index aeb64a46b..8a2384b6f 100644 --- a/module/apmgopg/go.mod +++ b/module/apmgopg/go.mod @@ -18,3 +18,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmsql => ../apmsql + +go 1.13 diff --git a/module/apmgorilla/go.mod b/module/apmgorilla/go.mod index 759ffefd3..661bad967 100644 --- a/module/apmgorilla/go.mod +++ b/module/apmgorilla/go.mod @@ -11,3 +11,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmgorm/go.mod b/module/apmgorm/go.mod index 6944dd669..d7073a3ff 100644 --- a/module/apmgorm/go.mod +++ b/module/apmgorm/go.mod @@ -14,3 +14,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmsql => ../apmsql + +go 1.13 diff --git a/module/apmgrpc/go.mod b/module/apmgrpc/go.mod index 197577750..9e96ceeb8 100644 --- a/module/apmgrpc/go.mod +++ b/module/apmgrpc/go.mod @@ -12,3 +12,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmhttp/go.mod b/module/apmhttp/go.mod index 185021204..0ad3f313f 100644 --- a/module/apmhttp/go.mod +++ b/module/apmhttp/go.mod @@ -9,3 +9,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/module/apmhttprouter/go.mod b/module/apmhttprouter/go.mod index 6e4b38bb5..76ce234c7 100644 --- a/module/apmhttprouter/go.mod +++ b/module/apmhttprouter/go.mod @@ -10,3 +10,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmlambda/go.mod b/module/apmlambda/go.mod index d703769c4..c1019114c 100644 --- a/module/apmlambda/go.mod +++ b/module/apmlambda/go.mod @@ -6,3 +6,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/module/apmlogrus/go.mod b/module/apmlogrus/go.mod index 078a2bbb0..e22837884 100644 --- a/module/apmlogrus/go.mod +++ b/module/apmlogrus/go.mod @@ -9,3 +9,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/module/apmmongo/go.mod b/module/apmmongo/go.mod index ab0e187bf..f925e7f86 100644 --- a/module/apmmongo/go.mod +++ b/module/apmmongo/go.mod @@ -15,3 +15,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/module/apmot/go.mod b/module/apmot/go.mod index 6fa9aa38d..96d103b66 100644 --- a/module/apmot/go.mod +++ b/module/apmot/go.mod @@ -10,3 +10,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmprometheus/go.mod b/module/apmprometheus/go.mod index fbc175e65..66ed54530 100644 --- a/module/apmprometheus/go.mod +++ b/module/apmprometheus/go.mod @@ -9,3 +9,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/module/apmredigo/go.mod b/module/apmredigo/go.mod index 3234317de..e07a9c31f 100644 --- a/module/apmredigo/go.mod +++ b/module/apmredigo/go.mod @@ -7,3 +7,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/module/apmrestful/go.mod b/module/apmrestful/go.mod index a1c467fa4..712563883 100644 --- a/module/apmrestful/go.mod +++ b/module/apmrestful/go.mod @@ -13,3 +13,5 @@ require ( replace go.elastic.co/apm => ../.. replace go.elastic.co/apm/module/apmhttp => ../apmhttp + +go 1.13 diff --git a/module/apmsql/go.mod b/module/apmsql/go.mod index 7dd21a9cb..fde932c6e 100644 --- a/module/apmsql/go.mod +++ b/module/apmsql/go.mod @@ -10,3 +10,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/module/apmzap/go.mod b/module/apmzap/go.mod index 0cc1f9a16..9ed1a1cb0 100644 --- a/module/apmzap/go.mod +++ b/module/apmzap/go.mod @@ -10,3 +10,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/module/apmzerolog/go.mod b/module/apmzerolog/go.mod index 6c47d138b..f177ccc64 100644 --- a/module/apmzerolog/go.mod +++ b/module/apmzerolog/go.mod @@ -8,3 +8,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/scripts/genmod/go.mod b/scripts/genmod/go.mod index adb8c403b..f38ba298c 100644 --- a/scripts/genmod/go.mod +++ b/scripts/genmod/go.mod @@ -6,3 +6,5 @@ require ( ) replace go.elastic.co/apm => ../.. + +go 1.13 diff --git a/scripts/genmod/main.go b/scripts/genmod/main.go index 0fc102d01..6ec4212d6 100644 --- a/scripts/genmod/main.go +++ b/scripts/genmod/main.go @@ -22,6 +22,7 @@ import ( "encoding/json" "flag" "fmt" + "go/build" "io/ioutil" "log" "os" @@ -130,7 +131,7 @@ func updateModule(dir string, gomod *GoMod, modules map[string]*GoMod) error { "-replace", require.Path+"="+relDir, ) cmd.Env = append(os.Environ(), "GO111MODULE=on") - cmd.Env = append(cmd.Env, "GOPROXY=http://proxy.invalid") + cmd.Env = append(cmd.Env, "GOPROXY=http://proxy.invalid", "GOSUMDB=sum.golang.org https://sum.golang.org") cmd.Stderr = os.Stderr cmd.Dir = dir if err := cmd.Run(); err != nil { @@ -198,18 +199,18 @@ func checkModuleComplete(dir string, gomod *GoMod, modules map[string]*GoMod) er cmd.Stderr = os.Stderr cmd.Dir = gomod.dir if err := cmd.Run(); err != nil { - return err + return errors.Wrap(err, "'go mod download' failed") } // Check we can build the module's tests and its transitive dependencies // without updating go.mod. cmd = exec.Command("go", "test", "-c", "-mod=readonly", "-o", os.DevNull) cmd.Env = append(os.Environ(), "GO111MODULE=on") - cmd.Env = append(cmd.Env, "GOPROXY=http://proxy.invalid") + cmd.Env = append(cmd.Env, "GOPROXY=http://proxy.invalid", "GOSUMDB=sum.golang.org https://sum.golang.org") cmd.Stderr = os.Stderr cmd.Dir = gomod.dir if err := cmd.Run(); err != nil { - return err + return errors.Wrap(err, "'go test' failed") } // We create a temporary program which imports the module, and then @@ -243,6 +244,9 @@ func main() {} gomod := modules[path] fmt.Fprintf(&tmpGomodContent, "\nreplace %s => %s\n", path, gomod.dir) } + // Add "go ", using the latest release tag. + tags := build.Default.ReleaseTags + fmt.Fprintf(&tmpGomodContent, "\ngo %s\n", tags[len(tags)-1][2:]) if err := ioutil.WriteFile(tmpGomodPath, tmpGomodContent.Bytes(), 0644); err != nil { return err @@ -253,7 +257,7 @@ func main() {} cmd = exec.Command("go", "mod", "tidy", "-v") cmd.Env = append(os.Environ(), "GO111MODULE=on") - cmd.Env = append(cmd.Env, "GOPROXY=http://proxy.invalid") + cmd.Env = append(cmd.Env, "GOPROXY=http://proxy.invalid", "GOSUMDB=sum.golang.org https://sum.golang.org") cmd.Stderr = os.Stderr cmd.Dir = tmpdir if err := cmd.Run(); err != nil {