1
0
mirror of https://github.com/golang/go synced 2024-11-19 16:54:44 -07:00

cmd/go: document that BinaryOnly packages must have accurate import info

Update BinaryOnly test by adding import _ "fmt".

Change-Id: I3a1dcfb83a27d8ff50a658060a46e1a3f481f6c7
Reviewed-on: https://go-review.googlesource.com/56276
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Russ Cox 2017-06-09 12:29:43 -04:00
parent 13f7fe00d4
commit d52413d62d
3 changed files with 9 additions and 4 deletions

View File

@ -917,8 +917,10 @@
// comment, indicating that the package sources are included
// for documentation only and must not be used to build the
// package binary. This enables distribution of Go packages in
// their compiled form alone. See the go/build package documentation
// for more details.
// their compiled form alone. Even binary-only packages require
// accurate import blocks listing required dependencies, so that
// those dependencies can be supplied when linking the resulting
// command.
//
//
// GOPATH environment variable

View File

@ -3618,6 +3618,7 @@ func TestBinaryOnlyPackages(t *testing.T) {
tg.tempFile("src/p1/missing.go", `//go:binary-only-package
package p1
import _ "fmt"
func G()
`)
tg.wantNotStale("p1", "no source code", "should NOT want to rebuild p1 (first)")

View File

@ -565,8 +565,10 @@ Non-test Go source files can also include a //go:binary-only-package
comment, indicating that the package sources are included
for documentation only and must not be used to build the
package binary. This enables distribution of Go packages in
their compiled form alone. See the go/build package documentation
for more details.
their compiled form alone. Even binary-only packages require
accurate import blocks listing required dependencies, so that
those dependencies can be supplied when linking the resulting
command.
`,
}