我使用的是64位Linux,并且尝试设置Go进行交叉编译(特别是Windows)。有这一个真棒指南这里。但是当我尝试运行下面的第二个命令时:
cd /usr/lib/go/src
sudo GOOS=windows GOARCH=386 CGO_ENABLED=0 ./make.bash --no-clean
尝试构建cmd
软件包时出现错误。它说use of internal package not allowed
。这是Go的主要源代码中的错误吗?我将粘贴完整的错误列表。
# Building packages and commands for host, linux/amd64.
package cmd/cmd/pprof
imports cmd/pprof/internal/driver: use of internal package not allowed
package cmd/cmd/pprof
imports cmd/pprof/internal/fetch: use of internal package not allowed
package cmd/cmd/pprof
imports cmd/pprof/internal/symbolizer: use of internal package not allowed
package cmd/cmd/pprof
imports cmd/pprof/internal/symbolz: use of internal package not allowed
package cmd/cmd/pprof/internal/commands
imports cmd/pprof/internal/report: use of internal package not allowed
package cmd/cmd/pprof/internal/commands
imports cmd/pprof/internal/svg: use of internal package not allowed
package cmd/cmd/pprof/internal/commands
imports cmd/pprof/internal/tempfile: use of internal package not allowed
package cmd/cmd/pprof/internal/driver
imports cmd/pprof/internal/commands: use of internal package not allowed
package cmd/cmd/pprof/internal/driver
imports cmd/pprof/internal/report: use of internal package not allowed
package cmd/cmd/pprof/internal/driver
imports cmd/pprof/internal/tempfile: use of internal package not allowed
package cmd/cmd/pprof/internal/fetch
imports cmd/pprof/internal/plugin: use of internal package not allowed
package cmd/cmd/pprof/internal/fetch
imports cmd/pprof/internal/profile: use of internal package not allowed
package cmd/cmd/pprof/internal/plugin
imports cmd/pprof/internal/profile: use of internal package not allowed
package cmd/cmd/pprof/internal/report
imports cmd/pprof/internal/plugin: use of internal package not allowed
package cmd/cmd/pprof/internal/report
imports cmd/pprof/internal/profile: use of internal package not allowed
package cmd/cmd/pprof/internal/symbolizer
imports cmd/pprof/internal/plugin: use of internal package not allowed
package cmd/cmd/pprof/internal/symbolizer
imports cmd/pprof/internal/profile: use of internal package not allowed
package cmd/cmd/pprof/internal/symbolz
imports cmd/pprof/internal/profile: use of internal package not allowed
我在Google上找不到类似的东西,所以这可能意味着我做错了事。顺便说一下,我使用的是Arch Linux,并且安装Go
了pacman
,而不是从源头安装。
此错误来自cmd/go/pkg.go#L358
,并查看blame视图,该视图已由go 1.4的commit 1338f32引入
因此,由于Go 1.4“内部”包的主张,该指南可能仅适用于go 1.3-,而不适用于go 1.4 。
对于Go 1.4,我们将首先针对
$GOROOT
而不是实施规则$GOPATH
。我们将使用编译器转换和标准库中的一些次要用法来获得使用该规则的经验。由于主存储库中的不规则性,在特殊情况下,路径中的“
/pkg/
”元素$GOROOT/src/pkg/…
被认为不存在。
这意味着$GOROOT/src/pkg/internal
可以通过进口$GOROOT/src/cmd/…
除$GOROOT/src/pkg/…
。
当我们将标准库上移到时,将删除这种特殊情况$GOROOT/src/
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句