From 28fa1da9db8eedf079f1b83fd39383e17b3d7e68 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Thu, 4 Oct 2018 16:46:22 +0800 Subject: cmd/api: explicit tagKey with GOOS and GOARCH The origin tagKey is just dirname if no tags input which will cause pkgCache missmatch if other imported pkg explicit on GOARCH or GOOS This CL will add GOOS and GOARCH to tagKey Fixes #8425 Fixes #21181 Change-Id: Ifc189cf6746d753ad7c7e5bb60621297fc0a4e35 Reviewed-on: https://go-review.googlesource.com/c/138315 Reviewed-by: Robert Griesemer --- src/cmd/api/goapi_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/cmd/api/goapi_test.go') diff --git a/src/cmd/api/goapi_test.go b/src/cmd/api/goapi_test.go index 3c4e50a21a..1c8e2a345b 100644 --- a/src/cmd/api/goapi_test.go +++ b/src/cmd/api/goapi_test.go @@ -188,3 +188,18 @@ func BenchmarkAll(b *testing.B) { } } } + +func TestIssue21181(t *testing.T) { + for _, c := range contexts { + c.Compiler = build.Default.Compiler + } + for _, context := range contexts { + w := NewWalker(context, "testdata/src/issue21181") + pkg, err := w.Import("p") + if err != nil { + t.Fatalf("%s: (%s-%s) %s %v", err, context.GOOS, context.GOARCH, + pkg.Name(), w.imported) + } + w.export(pkg) + } +} -- cgit v1.3