'go get' installation process fails - is deprecated in go
therealbenturnbull opened this issue · 2 comments
Running the installation command go get github.com/edgedb/edgedb-go
on a clean system does not work.
It produces the following error:
'go get' is no longer supported outside a module.
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'.
go version
produces the following:
go version go1.18.4 darwin/arm64
Googling says the following:
Starting in Go 1.17, installing executables with go get is deprecated. go install may be used instead. In Go 1.18, go get will no longer build packages; it will only be used to add, update, or remove dependencies in go. mod . Specifically, go get will always act as if the -d flag were enabled.
I might be missing something, but I can't get go install to work with the obvious solutions.
Can the documentation please be updated to help people new to Go?
Thanks for sharing your experience! This is helpful.
Ok so go install
is for installing programs that you would use in your command line. However github.com/edgedb/edgedb-go
is not a program. It is a library. To use it in your project you first have to initialize the go project (module) with
go mod init github.com/therealbentrunbull/my-project
Then in the directory where you ran go mod init
you can run
go get github.com/edgedb/edgedb-go
Which adds it as a dependency to your module.
I'll add something to the docs about this.
That's great! Thanks!
It will help people (like me) who are still new to this.