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

Use Go 1.20+ Error Wrapping #519

Closed
conallob opened this issue May 15, 2023 · 0 comments · Fixed by #617
Closed

Use Go 1.20+ Error Wrapping #519

conallob opened this issue May 15, 2023 · 0 comments · Fixed by #617

Comments

@conallob
Copy link
Contributor

Follow on from #358

https://go.dev/doc/go1.20#errors introduces the ability to wrap multiple errors using multiple %w atoms in fmt.Errorf()

Once Go v1.20 is the default version, fmt.Errorf() entries should be updated to use multiple %w atoms. Thanks to #358 , this should be replacing %s for %w

rexagod added a commit to rexagod/procfs that referenced this issue Mar 21, 2024
The `%w` verb was introduced in `go1.20` which allows for error
wrapping. However, even though the minimum supported version was
specified as `go1.19` there are already sparse occurences of the `%w`
verb throughout the codebase. Hence it's safe to move the minimum
supported version to `go1.20` since its constructs have been in use
within the repository for a while now.

Refer: https://go.dev/doc/go1.20#errors
Fixes: prometheus#519
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
SuperQ pushed a commit that referenced this issue Apr 10, 2024
* *: `s/(%v|%s)/%w` for all `fmt.Errorf` errors

The `%w` verb was introduced in `go1.20` which allows for error
wrapping. However, even though the minimum supported version was
specified as `go1.19` there are already sparse occurences of the `%w`
verb throughout the codebase. Hence it's safe to move the minimum
supported version to `go1.20` since its constructs have been in use
within the repository for a while now.

Refer: https://go.dev/doc/go1.20#errors
Fixes: #519
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>

* chore: Specify minimum Golang version as `1.20`

PTAL at the previous commit (d559fd9) for more details.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>

* fixup! chore: Specify minimum Golang version as `1.20`

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>

---------

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
jritter pushed a commit to jritter/procfs that referenced this issue Jul 15, 2024
* *: `s/(%v|%s)/%w` for all `fmt.Errorf` errors

The `%w` verb was introduced in `go1.20` which allows for error
wrapping. However, even though the minimum supported version was
specified as `go1.19` there are already sparse occurences of the `%w`
verb throughout the codebase. Hence it's safe to move the minimum
supported version to `go1.20` since its constructs have been in use
within the repository for a while now.

Refer: https://go.dev/doc/go1.20#errors
Fixes: prometheus#519
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>

* chore: Specify minimum Golang version as `1.20`

PTAL at the previous commit (d559fd9) for more details.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>

* fixup! chore: Specify minimum Golang version as `1.20`

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>

---------

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant