Skip to content

Commit 714b3ed

Browse files
authored
samples: move go.mod into samples root, making samples its own module (#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.
1 parent 1e22a7f commit 714b3ed

File tree

4 files changed

+182
-10
lines changed

4 files changed

+182
-10
lines changed

internal/testing/alldeps

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ github.com/google/go-cmp
3232
github.com/google/go-github
3333
github.com/google/go-querystring
3434
github.com/google/martian
35-
github.com/google/subcommands
3635
github.com/google/uuid
3736
github.com/google/wire
3837
github.com/googleapis/gax-go
@@ -77,7 +76,7 @@ gocloud.dev
7776
gocloud.dev/internal/cmd/gocdk
7877
gocloud.dev/internal/contributebot
7978
gocloud.dev/internal/website
80-
gocloud.dev/samples/appengine/helloworld
79+
gocloud.dev/samples
8180
golang.org/x/crypto
8281
golang.org/x/net
8382
golang.org/x/oauth2
@@ -91,6 +90,5 @@ google.golang.org/api
9190
google.golang.org/appengine
9291
google.golang.org/genproto
9392
google.golang.org/grpc
94-
gopkg.in/pipe.v2
9593
gopkg.in/square/go-jose.v2
9694
pack.ag/amqp

samples/appengine/go.mod

Lines changed: 0 additions & 7 deletions
This file was deleted.

samples/go.mod

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module gocloud.dev/samples
2+
3+
require (
4+
contrib.go.opencensus.io/exporter/stackdriver v0.11.0
5+
git.apache.org/thrift.git v0.12.0 // indirect
6+
github.com/Azure/azure-pipeline-go v0.1.9
7+
github.com/Azure/azure-storage-blob-go v0.6.0
8+
github.com/aws/aws-sdk-go v1.19.16
9+
github.com/go-sql-driver/mysql v1.4.1
10+
github.com/google/subcommands v1.0.1
11+
github.com/google/wire v0.2.1
12+
github.com/gorilla/mux v1.7.1
13+
go.opencensus.io v0.21.0
14+
gocloud.dev v0.13.0
15+
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7
16+
gopkg.in/pipe.v2 v2.0.0-20140414041502-3c2ca4d52544
17+
)
18+
19+
replace gocloud.dev => ../

0 commit comments

Comments
 (0)