From 7b46867d6ed3a1b0d45b9f647bd577585d451207 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 25 Jul 2018 10:03:40 -0700 Subject: [PATCH] cmd/go: for missing binary-only package, say where it should be Before this CL the user effectively has to guess at the expected location of a binary-only package. While the location is normally obvious ($GOPATH/pkg/GOOS_GOARCH/PATH/PKG.a) it is much less so when building with options that implicitly add an -installsufix option. Fixes #26590 Change-Id: I753ef54d6dcf733bb456dba65a4a92e4db57a1b0 Reviewed-on: https://go-review.googlesource.com/125818 Reviewed-by: Brad Fitzpatrick Reviewed-by: Bryan C. Mills --- src/cmd/go/internal/work/exec.go | 2 +- src/cmd/go/testdata/script/binary_only.txt | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/cmd/go/testdata/script/binary_only.txt diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 5d3d2ef77f..38ff22211c 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -411,7 +411,7 @@ func (b *Builder) build(a *Action) (err error) { if b.IsCmdList { return nil } - return fmt.Errorf("missing or invalid binary-only package") + return fmt.Errorf("missing or invalid binary-only package; expected file %q", a.Package.Target) } if err := b.Mkdir(a.Objdir); err != nil { diff --git a/src/cmd/go/testdata/script/binary_only.txt b/src/cmd/go/testdata/script/binary_only.txt new file mode 100644 index 0000000000..397904efaa --- /dev/null +++ b/src/cmd/go/testdata/script/binary_only.txt @@ -0,0 +1,10 @@ +# check that error for missing binary-only says where it should be +! go build b +stderr pkg[\\/].*a\.a + +-- a/a.go -- +//go:binary-only-package + +package a +-- b/b.go -- +package b; import "a" -- 2.50.0