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.
  • Loading branch information
eliben authored May 13, 2019
1 parent 1e22a7f commit 714b3ed
Show file tree
Hide file tree
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
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 => ../
Loading

0 comments on commit 714b3ed

Please sign in to comment.