首页 > 后端开发 > Golang > 正文

Go模块安装错误'undefined:any”

王林
发布: 2024-02-08 22:09:25
转载
798 人浏览过

Go模块安装错误undefined:any”

在使用Go语言开发过程中,我们经常会遇到各种各样的问题。其中,一个常见的问题是在安装Go模块时遇到错误提示"undefined:any"。这个错误提示可能让人困惑,不知道该如何解决。php小编柚子将为大家提供解决这个问题的方法和技巧,帮助大家顺利安装Go模块,提高开发效率。

问题内容

我收到以下错误。有人可以尝试相同的命令吗?我想知道这是包中的错误还是与我使用的 go 版本或我的设置有关。

$ go get github.com/gonejack/webarchive-to-html
# github.com/alecthomas/kong
../../../go/src/github.com/alecthomas/kong/callbacks.go:105:65: undefined: any
../../../go/src/github.com/alecthomas/kong/callbacks.go:124:15: undefined: any
../../../go/src/github.com/alecthomas/kong/context.go:723:27: undefined: any
../../../go/src/github.com/alecthomas/kong/options.go:59:8: undefined: any
../../../go/src/github.com/alecthomas/kong/options.go:66:18: undefined: any
$ echo $?
2
$ go version
go version go1.16 darwin/amd64
登录后复制

解决方法

让我们看看 go.mod 文件您想要获取的包裹。该包是基于golang 1.18版本编写的。所以你至少需要1.18版本。

module github.com/gonejack/webarchive-to-html

go 1.18

...
登录后复制

go 1.18 中引入了内置类型 anyany 是 interface{} 的简单别名。

// builtin.go
type any = interface{}
登录后复制

以上是Go模块安装错误'undefined:any”的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
来源:stackoverflow.com
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!