我正在使用Linux 64位,我正在尝试设置Go进行交叉编译(特别是针对Windows)。这个here有一个很棒的指南。但是当我尝试运行下面的第二个命令时:
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
我在谷歌上找不到这样的东西,所以这可能意味着我做错了什么。顺便说一下,我正在使用Arch Linux,我使用Go
安装了pacman
,而不是来自源代码。
答案 0 :(得分:2)
此错误来自cmd/go/pkg.go#L358
,看看责备视图显示commit 1338f32已为此引入了1.4
因为Go 1.4 "Internal" Package proposition,指南可能只适用于1.3-而不是1.4。
对于Go 1.4,我们将首先针对
$GOROOT
实施规则,但不针对$GOPATH
实施规则。我们将使用编译器转换和标准库中的一些次要用法来获得规则的经验。由于主仓库的不规则性,作为特殊情况,
/pkg/
路径中的“$GOROOT/src/pkg/…
”元素被视为不存在。
这意味着除了$GOROOT/src/pkg/internal
之外,$GOROOT/src/cmd/…
可以$GOROOT/src/pkg/…
导入$GOROOT/src/
当我们将标准库移动到{{1}}时,将删除此特例。