卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章34356本站已运行393

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

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{}
卓越飞翔博客
上一篇: GORM Find(&room) 操作用空数据而不是实际数据填充结构
下一篇: 返回列表
留言与评论(共有 0 条评论)
   
验证码:
隐藏边栏