我對 GO 很陌生。試圖了解如何在 go 模塊中構(gòu)建我的項目。正如您在屏幕截圖中看到的那樣,我有一個 go 模塊。在里面我有 main.go 。以下是內(nèi)容。package mainimport "go-test/repo/test"func main() { test.GetFun()}在 repo/test.go 里面,下面是內(nèi)容。package repoimport "fmt"// GetFun just for funfunc GetFun() { fmt.Println("fun")}當(dāng)我運行時,go build 以下是我得到的錯誤。 maing.go:3:8: package go-test/repo/test is not in GOROOT (/usr/local/go/src/go-test/repo/test)
單個go模塊中的多個包
30秒到達戰(zhàn)場
2022-06-13 17:05:25