Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update setup guide since go get is deprecated / no longer supported and will throw an error #1598

Closed
romain-chanu opened this issue Apr 1, 2024 · 4 comments · Fixed by #1599
Labels

Comments

@romain-chanu
Copy link

Describe the bug

The setup guide instructs users to install the Elastic APM Go agent package using go get:

go get -u go.elastic.co/apm/v2

However, go get is deprecated since Go version >= 1.17 (c.f Deprecation of 'go get' for installing executables) and will throw an error if users try to use this command to install the APM Go agent package (c.f below).

To Reproduce

  • Spin-up a VM with Go installed
  • Run go get -u go.elastic.co/apm/v2 and observe the below error:
[root@ropc ~]# go get -u go.elastic.co/apm/v2
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'.

Expected behavior
Update the setup guide to use go install go.elastic.co/apm/v2@latest instead

@dmathieu
Copy link
Member

dmathieu commented Apr 2, 2024

As the error suggests, you need to be within a Go module (a go.mod file need to be present in the current directory or a parent one).
go install won't work here, as it is meant for main packages (to build binaries, not for libraries).

When I run go get within a Go package, it works fine.

dmathieu/test›  git:(main) go get -u go.elastic.co/apm/v2
go: added github.com/elastic/go-sysinfo v1.13.1
go: added github.com/elastic/go-windows v1.0.1
go: added github.com/prometheus/procfs v0.13.0
go: added go.elastic.co/apm/v2 v2.5.0
go: added go.elastic.co/fastjson v1.3.0
go: upgraded golang.org/x/net v0.12.0 => v0.17.0
go: added howett.net/plist v1.0.1
dmathieu/test›  git:(main) 2M

@romain-chanu
Copy link
Author

Hi @dmathieu - Thank you for the explanation. If go get is a valid instruction to setup the APM Go Agent, do you think we could add some clarifications in our documentation to be more explicit and state that the go get should be executed within a Go module folder / package?

The current documentation states

Install the Elastic APM Go agent package using go get:

Being more specific would make sense here.

@dmathieu
Copy link
Member

dmathieu commented Apr 2, 2024

Sure. How about #1599?

@romain-chanu
Copy link
Author

Yes that looks good 👍 - Thank you @dmathieu 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants