Skip to content

Commit 7b46867

Browse files
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 <bradfitz@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
1 parent c0e5485 commit 7b46867

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/cmd/go/internal/work/exec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ func (b *Builder) build(a *Action) (err error) {
411411
if b.IsCmdList {
412412
return nil
413413
}
414-
return fmt.Errorf("missing or invalid binary-only package")
414+
return fmt.Errorf("missing or invalid binary-only package; expected file %q", a.Package.Target)
415415
}
416416

417417
if err := b.Mkdir(a.Objdir); err != nil {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# check that error for missing binary-only says where it should be
2+
! go build b
3+
stderr pkg[\\/].*a\.a
4+
5+
-- a/a.go --
6+
//go:binary-only-package
7+
8+
package a
9+
-- b/b.go --
10+
package b; import "a"

0 commit comments

Comments
 (0)