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

fixing outdated instruction to get Go packages #2563

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion content/docs/guides/go-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,21 @@ NOTE: For comprehensive API documentation, see the [GoDoc](https://godoc.org/git

## Installation

You can install the `prometheus`, `promauto`, and `promhttp` libraries necessary for the guide using [`go get`](https://golang.org/doc/articles/go_command.html):
To integrate Prometheus with your Go application, you'll need the `prometheus`, `promauto`, and `promhttp` libraries. Starting with Go 1.17, Go Modules are required for managing dependencies.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, but I'm afraid the more we add, the more maintenance it will require.
Let's just replace the existing link https://golang.org/doc/articles/go_command.html with with https://go.dev/ref/mod#go-get which is more module oriented.

And to be honest the warning when using go get outside a module is clear enough:

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'.


#### Using Go Modules

If your project does not already use Go Modules, initialize a new module in your project directory:

```bash
go mod init <module_name>
```
Replace <module_name> with a name that represents your project.
NOTE: For more details see the [`go mod init`](https://go.dev/doc/tutorial/create-module) documentation.

#### Installing Prometheus Libraries

Once your project is using Go Modules, install the Prometheus client libraries using [`go get`](https://golang.org/doc/articles/go_command.html):

```bash
go get github.com/prometheus/client_golang/prometheus
Expand Down