dongwuzun4630 2019-01-11 05:15
浏览 206

cmd / go:go:binary-only-package在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.

Source: https://golang.org/doc/go1.10#build

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$
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据