I am trying to build the package github.com/go-delve/delve/cmd/dlv@2f13672765fe and have the resulting executable named dlv-dap.
Under older versions of go (pre 1.16) I was able to accomplish this by running the following commands.
go get github.com/go-delve/delve/cmd/dlv@2f13672765fego build -o dlv-dap github.com/go-delve/delve/cmd/dlv@2f13672765fe
Under v1.17 this no longer works, instead the command go get github.com/go-delve/delve/cmd/dlv@2f13672765fe throws the following 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 https://golang.org/doc/go-get-install-deprecation or run 'go help get' or 'go help install'.
Reading the information link provided in the error it seems there is no longer a way to download/build a golang package with a customized name (e.g. -o my_custom_named_executable).
Is my understanding correct or is there another way to accomplish this?
go installinstead ofgo get, with the same syntax. Now you can only rungo getin a go module directory to add a dependency.go installdoes not accept the-oflag... as stated I want a custom named executable,go installdoes not offer this level of controlgo installwill add the binary to your$GOPATH/bindirectory without you needing to build it yourself.go buildstill exists to compile from sources, what you can do if you want to build it yourself is clone the project and run your go build command from the root.