Gorilla/mux error

Is gorilla/mux still used? Why do I get this error when I type this command (get GitHub - gorilla/mux: A powerful HTTP router and URL matcher for building Go web servers with 🦍) in terminal?
error
go: go.mod file not found in current directory or any parent directory.
‘go get’ is no longer supported outside a module.
To build and install a command, use ‘go install’ with a version,
like ‘go install example.com/cmd@latest
For more information, see Deprecation of 'go get' for installing executables - The Go Programming Language
or run ‘go help get’ or ‘go help install’.

Yes it’s still used. You’re getting that message because you didn’t initialize a module in your current directory. Consider the following:

# Doesn't work because I haven't initialized a module.
$ go get github.com/gorilla/mux
go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.

# So I'll initialize a module
$ go mod init forum.golangbridge.org/testproject
go: creating new go.mod: module forum.golangbridge.org/testproject

# And now all is well
$ go get github.com/gorilla/mux
go: added github.com/gorilla/mux v1.8.0

It sounds like you aren’t familiar with modules yet. Give this a read if you want to get started:

Also, gorilla/mux is in archive mode:

But I can’t imagine it won’t be maintained by somebody, and since it is stdlib compatible it is still safe to use IMO. It’s also been battle tested for many years and probably doesn’t need to change much.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.