首頁  >  文章  >  後端開發  >  下載我的模組時出現奇怪的行為

下載我的模組時出現奇怪的行為

WBOY
WBOY轉載
2024-02-10 11:10:08797瀏覽

下載我的模組時出現奇怪的行為

php小編香蕉有關下載模組時出現奇怪行為的問題,可能是由於多種原因導致的。有時候,下載的模組可能損壞或不完整,這可能會導致奇怪的行為。另外,也有可能是伺服器或網路連線問題所導致的下載問題。在解決這個問題之前,我們需要仔細檢查這些可能的原因,並採取相應的措施來解決。接下來,我將為您提供一些解決這個問題的方法和建議。

問題內容

每當我使用go get 下載我製作的模組(https://github.com/torbenconto/plutus)時,它不會讓我使用任何子包,直到我在我下載的項目上運行go mod tidy它到。請幫幫我,我不知道如何解決這個問題!

這是我模組的 go.mod

module github.com/torbenconto/plutus/api

go 1.21

toolchain go1.21.1

require (
    github.com/gin-gonic/gin v1.9.1
    github.com/torbenconto/plutus v1.3.0
)

require (
    github.com/PuerkitoBio/goquery v1.8.1 // indirect
    github.com/andybalholm/cascadia v1.3.2 // indirect
    github.com/antchfx/htmlquery v1.3.0 // indirect
    github.com/antchfx/xmlquery v1.3.18 // indirect
    github.com/antchfx/xpath v1.2.5 // indirect
    github.com/bytedance/sonic v1.10.2 // indirect
    github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
    github.com/chenzhuoyu/iasm v0.9.1 // indirect
    github.com/gabriel-vasile/mimetype v1.4.3 // indirect
    github.com/gin-contrib/sse v0.1.0 // indirect
    github.com/go-playground/locales v0.14.1 // indirect
    github.com/go-playground/universal-translator v0.18.1 // indirect
    github.com/go-playground/validator/v10 v10.16.0 // indirect
    github.com/gobwas/glob v0.2.3 // indirect
    github.com/goccy/go-json v0.10.2 // indirect
    github.com/gocolly/colly/v2 v2.1.0 // indirect
    github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
    github.com/golang/protobuf v1.5.3 // indirect
    github.com/json-iterator/go v1.1.12 // indirect
    github.com/kennygrant/sanitize v1.2.4 // indirect
    github.com/klauspost/cpuid/v2 v2.2.6 // indirect
    github.com/leodido/go-urn v1.2.4 // indirect
    github.com/mattn/go-isatty v0.0.20 // indirect
    github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
    github.com/modern-go/reflect2 v1.0.2 // indirect
    github.com/pelletier/go-toml/v2 v2.1.1 // indirect
    github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
    github.com/temoto/robotstxt v1.1.2 // indirect
    github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
    github.com/ugorji/go/codec v1.2.12 // indirect
    golang.org/x/arch v0.6.0 // indirect
    golang.org/x/crypto v0.17.0 // indirect
    golang.org/x/net v0.19.0 // indirect
    golang.org/x/sys v0.15.0 // indirect
    golang.org/x/text v0.14.0 // indirect
    google.golang.org/appengine v1.6.8 // indirect
    google.golang.org/protobuf v1.32.0 // indirect
    gopkg.in/yaml.v3 v3.0.1 // indirect
)

這是我將滑鼠懸停在模組的紅色底線導入上時收到的錯誤代碼 無法導入 github.com/torbenconto/plutus/quote (沒有必需的模組提供套件“github.com/torbenconto/plutus/quote”)compilerBrokenImport

當我在下載模組的專案中執行 go mod tidy 時,問題得到解決。 下載它的專案中的 go.mod 在運行 go mod tidy 之前變成了這樣

module test

go 1.21.1

require (
    github.com/torbenconto/plutus v1.4.1 // indirect
)

運行後到此

module test

go 1.21.1

require github.com/torbenconto/plutus v1.4.1

require (
    github.com/PuerkitoBio/goquery v1.8.1 // indirect
    github.com/andybalholm/cascadia v1.3.2 // indirect
    github.com/antchfx/htmlquery v1.3.0 // indirect
    github.com/antchfx/xmlquery v1.3.18 // indirect
    github.com/antchfx/xpath v1.2.5 // indirect
    github.com/gobwas/glob v0.2.3 // indirect
    github.com/gocolly/colly/v2 v2.1.0 // indirect
    github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
    github.com/golang/protobuf v1.5.3 // indirect
    github.com/kennygrant/sanitize v1.2.4 // indirect
    github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
    github.com/temoto/robotstxt v1.1.2 // indirect
    golang.org/x/net v0.19.0 // indirect
    golang.org/x/text v0.14.0 // indirect
    google.golang.org/appengine v1.6.8 // indirect
    google.golang.org/protobuf v1.31.0 // indirect
    gopkg.in/yaml.v3 v3.0.1 // indirect
)

請幫忙。

我嘗試在專案中運行 go mod tidy,但沒有成功,以及我在谷歌上找到的許多其他東西。經過幾個小時的故障排除後,到目前為止沒有任何效果。

解決方法

透過在我的主檔案(plutus.go) 中匯入子套件(在本例中為colly-go)使用的模組,導致go get 檢索所有需要的模組,解決了我的問題。

以上是下載我的模組時出現奇怪的行為的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:stackoverflow.com。如有侵權,請聯絡admin@php.cn刪除