Home >Backend Development >Golang >Go module installation error 'undefined: any'
In the process of using Go language development, we often encounter various problems. Among them, a common problem is encountering the error message "undefined: any" when installing Go modules. This error message can be confusing and you don’t know how to resolve it. PHP editor Youzi will provide you with methods and techniques to solve this problem, help you successfully install Go modules and improve development efficiency.
I receive the following error. Can anyone try the same command? I'm wondering if this is a bug in the package or something to do with the version of go I'm using or my setup.
$ 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
Let's take a look at the go.mod file for the package you want to get. This package is written based on golang version 1.18. So you need at least version 1.18.
module github.com/gonejack/webarchive-to-html go 1.18 ...
The built-in type any
was introduced in go 1.18. any
is a simple alias for interface{}.
// builtin.go type any = interface{}
The above is the detailed content of Go module installation error 'undefined: any'. For more information, please follow other related articles on the PHP Chinese website!