我的目標(biāo)是創(chuàng)建一個(gè)包含多個(gè)文件夾的存儲(chǔ)庫(kù)。|- go.work|- websocket| |- go.mod| |- go.sum| |- server.go|- channel| |- main.gowebsocket 使用github.com/gorilla/websocket包。所以,我需要在websocket文件夾中做。$ go mod init github.com/kidfrom/learn-golang/websocket$ go get github.com/gorilla/websocket@v1.5.0$ go work use .問(wèn)題是,websocket/go.mod拋出警告github.com/gorilla/websocket is not used in this module如果我這樣做go mod tidy,websocket/go.mod將被清除并websocket/server.go拋出錯(cuò)誤could not import github.com/gorilla/websocket (no required module provides package "github.com/gorilla/websocket")TLDRwebsocket/go.modmodule github.com/kidfrom/learn-golang/websocketgo 1.19require github.com/gorilla/websocket v1.5.0 // indirectwebsocket/go.sumgithub.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=websocket/server.gogo.workgo 1.19use ( ./websocket)
為什么 go get in a repository with go.work throws
桃花長(zhǎng)相依
2023-02-21 12:41:39
