我正在使用 Linux 64 位,我正在嘗試設置 Go 進行交叉編譯(特別是對于 Windows)。有這一個真棒指南這里。但是當我嘗試運行下面的第二個命令時:cd /usr/lib/go/srcsudo 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 allowedpackage cmd/cmd/pprof imports cmd/pprof/internal/fetch: use of internal package not allowedpackage cmd/cmd/pprof imports cmd/pprof/internal/symbolizer: use of internal package not allowedpackage cmd/cmd/pprof imports cmd/pprof/internal/symbolz: use of internal package not allowedpackage cmd/cmd/pprof/internal/commands imports cmd/pprof/internal/report: use of internal package not allowedpackage cmd/cmd/pprof/internal/commands imports cmd/pprof/internal/svg: use of internal package not allowedpackage cmd/cmd/pprof/internal/commands imports cmd/pprof/internal/tempfile: use of internal package not allowedpackage cmd/cmd/pprof/internal/driver imports cmd/pprof/internal/commands: use of internal package not allowedpackage cmd/cmd/pprof/internal/driver imports cmd/pprof/internal/report: use of internal package not allowedpackage cmd/cmd/pprof/internal/driver imports cmd/pprof/internal/tempfile: use of internal package not allowedpackage cmd/cmd/pprof/internal/fetch imports cmd/pprof/internal/plugin: use of internal package not allowedpackage cmd/cmd/pprof/internal/fetch imports cmd/pprof/internal/profile: use of internal package not allowedpackage cmd/cmd/pprof/internal/plugin imports cmd/pprof/internal/profile: use of internal package not allowedpackage cmd/cmd/pprof/internal/report imports cmd/pprof/internal/plugin: use of internal package not allowed我在谷歌上找不到這樣的東西,所以這可能意味著我做錯了什么。順便說一下,我正在使用 Arch Linux,并且我安裝的Go是pacman,而不是從源代碼。
1 回答

溫溫醬
TA貢獻1752條經驗 獲得超4個贊
這個錯誤來自cmd/go/pkg.go#L358
,查看一下blame視圖顯示這是由commit 1338f32為go 1.4引入的
因此,由于Go 1.4“內部”包主張,該指南可能僅適用于 go 1.3-,而不適用于 go 1.4 。
對于 Go 1.4,我們將首先為 實現規則
$GOROOT
,而不是$GOPATH
。我們將使用編譯器轉換和標準庫中的一些次要用途來獲得規則的經驗。由于主 repo 中的不規則性,作為特殊情況,路徑中的“
/pkg/
”元素$GOROOT/src/pkg/…
被認為不存在。
這意味著$GOROOT/src/pkg/internal
可以通過進口$GOROOT/src/cmd/…
除$GOROOT/src/pkg/…
。
當我們將標準庫向上移動到$GOROOT/src/
.
- 1 回答
- 0 關注
- 376 瀏覽
添加回答
舉報
0/150
提交
取消