]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: document that BinaryOnly packages must have accurate import info
authorRuss Cox <rsc@golang.org>
Fri, 9 Jun 2017 16:29:43 +0000 (12:29 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 18 Aug 2017 14:29:16 +0000 (14:29 +0000)
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>
src/cmd/go/alldocs.go
src/cmd/go/go_test.go
src/cmd/go/internal/help/helpdoc.go

index c3d75ee7930c12f80f19dbe379c0782bb2b45e0c..5f7de4adc0197be0f7d8a88d75fbf8f1ebe08577 100644 (file)
 // 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
index f0bdf97bd9c2f3f531955468bdd5635ce149366e..3aecc75f8758c7c922b22697cbf1b4d63d74f78c 100644 (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)")
index b9349ee8894768f4770cc710d59da805b084d14a..508ff60862b54a5fb6b812c700428dd1b0156a80 100644 (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.
        `,
 }