【问题标题】:Parsing go.mod: unexpected module path "howett.net/plist"解析 go.mod:意外的模块路径“howett.net/plist”
【发布时间】:2019-10-29 06:28:26
【问题描述】:

我想导入一个 Go 模块,它的 go.mod 中有以下内容:

> grep plist go.mod
    github.com/DHowett/go-plist v0.0.0-20180609054337-500bd5b9081b
    howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect

但是,如果我尝试 go get 那个包,我会收到以下错误消息:

go: github.com/DHowett/go-plist@v0.0.0-20181124034731-591f970eefbb: parsing go.mod: unexpected module path "howett.net/plist"
go get: error loading module requirements

如果我只是尝试go get github.com/DHowett/go-plist,我也会收到此错误:

> go get github.com/DHowett/go-plist
go: finding github.com/DHowett/go-plist latest
go: github.com/DHowett/go-plist@v0.0.0-20181124034731-591f970eefbb: parsing go.mod: unexpected module path "howett.net/plist"
go: error loading module requirements

如何修复此错误以便导入该模块?

【问题讨论】:

    标签: go go-modules


    【解决方案1】:

    此模块在go.mod 中的标识定义为howett.net/plist 而不是github.com/DHowett/go-plist

    如果你运行它,它应该可以正常工作:

    go get howett.net/plist
    

    另见官方 Golang Wiki 中的 this entry

    【讨论】:

      【解决方案2】:

      我最终通过替换解决了这个问题

      import "github.com/DHowett/go-plist
      

      模块中我想要导入的所有位置

      import "howett.net/plist
      

      并运行go mod tidy。之后,我就可以毫无错误地导入它了。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-09-29
        • 2017-07-01
        • 1970-01-01
        • 2018-01-29
        • 1970-01-01
        • 2022-01-15
        • 2021-08-18
        相关资源
        最近更新 更多