Skip to content

Commit

Permalink
Update genmod (elastic#629)
Browse files Browse the repository at this point in the history
- add GOSUMDB
- add "go <release>" to temporary go.mod for diff
- refreshes all of the go.mod's indirectly
  • Loading branch information
axw authored Sep 5, 2019
1 parent 1a2eb71 commit 956dc73
Show file tree
Hide file tree
Showing 30 changed files with 67 additions and 5 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ require (
go.elastic.co/fastjson v1.0.0
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e
)

go 1.13
2 changes: 2 additions & 0 deletions internal/tracecontexttest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions module/apmbeego/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions module/apmchi/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmhttp => ../apmhttp

go 1.13
2 changes: 2 additions & 0 deletions module/apmecho/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmhttp => ../apmhttp

go 1.13
2 changes: 2 additions & 0 deletions module/apmechov4/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmhttp => ../apmhttp

go 1.13
2 changes: 2 additions & 0 deletions module/apmelasticsearch/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmhttp => ../apmhttp

go 1.13
2 changes: 2 additions & 0 deletions module/apmelasticsearch/internal/integration/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions module/apmgin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmhttp => ../apmhttp

go 1.13
2 changes: 2 additions & 0 deletions module/apmgocql/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions module/apmgokit/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions module/apmgometrics/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions module/apmgopg/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmsql => ../apmsql

go 1.13
2 changes: 2 additions & 0 deletions module/apmgorilla/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmhttp => ../apmhttp

go 1.13
2 changes: 2 additions & 0 deletions module/apmgorm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmsql => ../apmsql

go 1.13
2 changes: 2 additions & 0 deletions module/apmgrpc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmhttp => ../apmhttp

go 1.13
2 changes: 2 additions & 0 deletions module/apmhttp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions module/apmhttprouter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmhttp => ../apmhttp

go 1.13
2 changes: 2 additions & 0 deletions module/apmlambda/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions module/apmlogrus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions module/apmmongo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions module/apmot/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmhttp => ../apmhttp

go 1.13
2 changes: 2 additions & 0 deletions module/apmprometheus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions module/apmredigo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions module/apmrestful/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ require (
replace go.elastic.co/apm => ../..

replace go.elastic.co/apm/module/apmhttp => ../apmhttp

go 1.13
2 changes: 2 additions & 0 deletions module/apmsql/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions module/apmzap/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions module/apmzerolog/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
2 changes: 2 additions & 0 deletions scripts/genmod/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ require (
)

replace go.elastic.co/apm => ../..

go 1.13
14 changes: 9 additions & 5 deletions scripts/genmod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"encoding/json"
"flag"
"fmt"
"go/build"
"io/ioutil"
"log"
"os"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -243,6 +244,9 @@ func main() {}
gomod := modules[path]
fmt.Fprintf(&tmpGomodContent, "\nreplace %s => %s\n", path, gomod.dir)
}
// Add "go <version>", 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
Expand All @@ -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 {
Expand Down

0 comments on commit 956dc73

Please sign in to comment.