As a result, if the command is run outside of any Go module, it shows the below error:
$ cd $HOME # not inside of any module
$ go install github.com/kei6u/kubectl-explore
go install: version is required when current directory is not in a module
Try 'go install github.com/kei6u/kubectl-explore@latest' to install the latest version
By appending the suffix ( @0.1.0 or even @latest should be OK), it successfully installs the command.
go install
can install an executable binary, but if the version suffix is missing, it tries to install the given package with module-aware mode. (ref: New module changes in Go 1.16 - The Go Programming Language)As a result, if the command is run outside of any Go module, it shows the below error:
By appending the suffix (
@0.1.0
or even@latest
should be OK), it successfully installs the command.Another reference: Deprecation of 'go get' for installing executables - The Go Programming Language