我對(duì) GO 很陌生。試圖了解如何在 go 模塊中構(gòu)建我的項(xiàng)目。正如您在屏幕截圖中看到的那樣,我有一個(gè) 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)我運(yùn)行時(shí),go build 以下是我得到的錯(cuò)誤。 maing.go:3:8: package go-test/repo/test is not in GOROOT (/usr/local/go/src/go-test/repo/test)
單個(gè)go模塊中的多個(gè)包
30秒到達(dá)戰(zhàn)場(chǎng)
2022-06-13 17:05:25
