cmd/go: go:binary-only-package not working in go 1.10 #24318
I know the issue #24318 i.e. https://github.com/golang/go/issues/24318 is closed but haven’t figured out how to fix the issue and be able to use BOP packages.
The new docs say:
One new requirement implied by these changes is that binary-only packages must now declare accurate import blocks in their stub source code, so that those imports can be made available when linking a program using the binary-only package.
However, personally that does not seem to convey exactly what actions the developer should take, it points you to https://golang.org/cmd/go/#hdr-File_types, however again I feel that it just mentions the following:
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. Even binary-only packages require accurate import blocks listing required dependencies, so that those dependencies can be supplied when linking the resulting command.
But no hint towards what to make of accurate import blocks , furthermore the Binary-Only Packagedocumentation does not mention how the go/importer package would be used for the BOP packages.
Any example of how to use it in 1.11 would be greatly appreciated!, thanks!, sorry for the trouble
-bash-4.2$ go env GOARCH="amd64" GOBIN="" GOCACHE="/home/ocu/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/ocu/octa" GOPROXY="" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build660160604=/tmp/go-build -gno-record-gcc-switches" -bash-4.2$