Skip to content

Commit

Permalink
samples: move go.mod into samples root, making samples its own module (
Browse files Browse the repository at this point in the history
…#2057)

Updates #2048 - moves the go.mod file from samples/appengine to samples.

Note the replace gocloud.dev => ../ added to the go.mod. Without this, running go test ./... in samples/ results in many errors like:

can't load package: package gocloud.dev/samples/server: unknown import path "gocloud.dev/samples/server": ambiguous import: found gocloud.dev/samples/server in multiple modules:
	gocloud.dev/samples (/home/eliben/eli/go-cloud/samples/server)
	gocloud.dev v0.13.0 (/home/eliben/eli/go/pkg/mod/[email protected]/samples/server)

The symptom and solution is explained by bcmills in ugorji/go#279 (which refers also to golang/go#27899). The new go.mod points to gocloud.dev v0.13, which also provides these packages - so the go command is confused - it sees the same package(s) provided by two different modules.

The ugorji/go solution was to use a pseudo-version pointing at an existing commit in the core module which removes the packages - this removes the ambiguity. In our case, there is no existing commit yet - so I'm using a replace line. The replace line should be unnecessary when we release a new CDK version.

This has interesting implications for #886 - we'll likely have to do the same when we split out providers to their own modules and retain replace lines until a new release.
eliben authored May 13, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 1e22a7f commit 714b3ed
Showing 4 changed files with 182 additions and 10 deletions.
4 changes: 1 addition & 3 deletions internal/testing/alldeps
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@ github.com/google/go-cmp
github.com/google/go-github
github.com/google/go-querystring
github.com/google/martian
github.com/google/subcommands
github.com/google/uuid
github.com/google/wire
github.com/googleapis/gax-go
@@ -77,7 +76,7 @@ gocloud.dev
gocloud.dev/internal/cmd/gocdk
gocloud.dev/internal/contributebot
gocloud.dev/internal/website
gocloud.dev/samples/appengine/helloworld
gocloud.dev/samples
golang.org/x/crypto
golang.org/x/net
golang.org/x/oauth2
@@ -91,6 +90,5 @@ google.golang.org/api
google.golang.org/appengine
google.golang.org/genproto
google.golang.org/grpc
gopkg.in/pipe.v2
gopkg.in/square/go-jose.v2
pack.ag/amqp
7 changes: 0 additions & 7 deletions samples/appengine/go.mod

This file was deleted.

19 changes: 19 additions & 0 deletions samples/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module gocloud.dev/samples

require (
contrib.go.opencensus.io/exporter/stackdriver v0.11.0
git.apache.org/thrift.git v0.12.0 // indirect
github.com/Azure/azure-pipeline-go v0.1.9
github.com/Azure/azure-storage-blob-go v0.6.0
github.com/aws/aws-sdk-go v1.19.16
github.com/go-sql-driver/mysql v1.4.1
github.com/google/subcommands v1.0.1
github.com/google/wire v0.2.1
github.com/gorilla/mux v1.7.1
go.opencensus.io v0.21.0
gocloud.dev v0.13.0
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7
gopkg.in/pipe.v2 v2.0.0-20140414041502-3c2ca4d52544
)

replace gocloud.dev => ../
162 changes: 162 additions & 0 deletions samples/appengine/go.sum → samples/go.sum

Large diffs are not rendered by default.

0 comments on commit 714b3ed

Please sign in to comment.