Oleksandr Redko
3264bf171b
refactor: modernize code ( #7850 )
...
Enable the
[`modernize`](https://golangci-lint.run/docs/linters/configuration/#modernize )
linter in the golangci-lint configuration and fix the reported issues by
running `golangci-lint run --enable-only modernize --fix`. The
`modernize` linter is internally the same as [gopls
modernize](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/modernize ).
Similar to #7089 .
2026-01-30 18:15:17 +01:00
Flc゛
80cb909774
refactor: replace context.Background() with t.Context()/b.Context() in tests ( #7352 )
...
Based on the Go version we currently use, the dependency already
supports 1.24+, which allows using `t.Context()` and `b.Context()` in
unit tests and benchmarks respectively.
- Enable `context-background` and `context-todo` in
[`usetesting`](https://golangci-lint.run/docs/linters/configuration/#usetesting )
- Adjust the code to support linter detection
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
Co-authored-by: Tyler Yahn <codingalias@gmail.com >
Co-authored-by: Damien Mathieu <42@dmathieu.com >
2025-09-23 09:52:45 +02:00
Matthieu MOREL
68841fa6db
chore: enable unused-receiver rule from revive ( #7130 )
...
#### Description
Enable and fixes
[unused-receiver](https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unused-receiver )
rule from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-08-08 15:38:22 -07:00
Matthieu MOREL
6d3e127cae
chore: enable ptrToRefParam from go-critic ( #7131 )
...
#### Description
Enable and fixes
[ptrToRefParam](https://go-critic.com/overview.html#ptrtorefparam ) rule
from go-critic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2025-08-07 11:52:16 -07:00
Matthieu MOREL
d464abf1f3
chore: enable unused-parameter rule from revive ( #7122 )
...
#### Description
Enable and fixes
[unused-parameter](https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unused-parameter )
rule from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-08-04 12:48:04 -07:00
Matthieu MOREL
1bae8f7347
chore: enable extra-rules from gofumpt ( #7114 )
...
#### Description
Enable extra rules from
[gofumpt](https://golangci-lint.run/usage/formatters/#gofumpt ) that also
fixes paramTypeCombine from go-critic
Also defines `go.opentelemetry.io/otel` as in
https://github.com/open-telemetry/opentelemetry-go-contrib/pull/7637
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2025-08-03 08:24:33 -07:00
Matthieu MOREL
982391315f
chore: enable gocritic linter ( #7095 )
...
#### Description
Enable and fixes several rules from
[gocritic](https://golangci-lint.run/usage/linters/#gocritic ) linter
---------
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2025-07-29 09:20:32 -07:00
Flc゛
8955578fef
ci: Add use-any linter ( #7091 )
...
Idea from https://github.com/open-telemetry/opentelemetry-go/pull/7089
(Can be processed after #7089 ).
Some example effects:
<img width="825" height="654" alt="image"
src="https://github.com/user-attachments/assets/d4d3d6ae-a644-42c4-90c5-43a83adf2808 "
/>
---------
Co-authored-by: Damien Mathieu <42@dmathieu.com >
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2025-07-29 08:18:09 -07:00
renovate[bot]
2cce189955
chore(deps): update module github.com/mgechev/revive to v1.10.0 ( #6841 )
...
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/mgechev/revive](https://redirect.github.com/mgechev/revive )
| `v1.9.0` -> `v1.10.0` |
[](https://docs.renovatebot.com/merge-confidence/ )
|
[](https://docs.renovatebot.com/merge-confidence/ )
|
[](https://docs.renovatebot.com/merge-confidence/ )
|
[](https://docs.renovatebot.com/merge-confidence/ )
|
---
> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.
---
### Release Notes
<details>
<summary>mgechev/revive (github.com/mgechev/revive)</summary>
###
[`v1.10.0`](https://redirect.github.com/mgechev/revive/releases/tag/v1.10.0 )
[Compare
Source](https://redirect.github.com/mgechev/revive/compare/v1.9.0...v1.10.0 )
#### What's Changed
- var-naming: detect meaningless package names by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1312 ](https://redirect.github.com/mgechev/revive/pull/1312 )
- docs: update golangci-lint configuration to v2 by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1318 ](https://redirect.github.com/mgechev/revive/pull/1318 )
- var-name checks each package name only once by
[@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1319 ](https://redirect.github.com/mgechev/revive/pull/1319 )
- var-naming: remove regex from code by
[@​mfederowicz](https://redirect.github.com/mfederowicz ) in
[https://github.com/mgechev/revive/pull/1322 ](https://redirect.github.com/mgechev/revive/pull/1322 )
- fix(1323): false positive in get-return rule for HTTP Get handlers by
[@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1325 ](https://redirect.github.com/mgechev/revive/pull/1325 )
- chore: enable a few revive rules by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1330 ](https://redirect.github.com/mgechev/revive/pull/1330 )
- chore: remove redundant typeparams for Go 1.17 by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1331 ](https://redirect.github.com/mgechev/revive/pull/1331 )
- chore: avoid third-party morphy2k/revive-action in CI by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1334 ](https://redirect.github.com/mgechev/revive/pull/1334 )
- chore: remove redundant //revive:disable-line by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1335 ](https://redirect.github.com/mgechev/revive/pull/1335 )
- fix(deps): update module golang.org/x/sync to v0.14.0 by
[@​renovate](https://redirect.github.com/renovate ) in
[https://github.com/mgechev/revive/pull/1337 ](https://redirect.github.com/mgechev/revive/pull/1337 )
- chore(deps): update module golang.org/x/sys to v0.33.0 by
[@​renovate](https://redirect.github.com/renovate ) in
[https://github.com/mgechev/revive/pull/1336 ](https://redirect.github.com/mgechev/revive/pull/1336 )
- chore(deps): update module golang.org/x/text to v0.25.0 by
[@​renovate](https://redirect.github.com/renovate ) in
[https://github.com/mgechev/revive/pull/1338 ](https://redirect.github.com/mgechev/revive/pull/1338 )
- fix(deps): update module golang.org/x/tools to v0.33.0 by
[@​renovate](https://redirect.github.com/renovate ) in
[https://github.com/mgechev/revive/pull/1339 ](https://redirect.github.com/mgechev/revive/pull/1339 )
- chore(deps): update codeberg.org/chavacava/garif to v0.2.0 by
[@​miparnisari](https://redirect.github.com/miparnisari ) in
[https://github.com/mgechev/revive/pull/1340 ](https://redirect.github.com/mgechev/revive/pull/1340 )
- docs: fix displaying rules table on revive.run by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1349 ](https://redirect.github.com/mgechev/revive/pull/1349 )
- Integrate golangci-lint into CI/CD pipeline by
[@​ArjunRajpal123](https://redirect.github.com/ArjunRajpal123 ) in
[https://github.com/mgechev/revive/pull/1346 ](https://redirect.github.com/mgechev/revive/pull/1346 )
- chore: remove unused deploy key by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1352 ](https://redirect.github.com/mgechev/revive/pull/1352 )
- Remove tablewriter dependency by
[@​volfgox](https://redirect.github.com/volfgox ) in
[https://github.com/mgechev/revive/pull/1351 ](https://redirect.github.com/mgechev/revive/pull/1351 )
- tiny refactoring on friendly, sarif and stylish formatters by
[@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1355 ](https://redirect.github.com/mgechev/revive/pull/1355 )
- fix(deps): update module github.com/mgechev/dots to v1.0.0 by
[@​renovate](https://redirect.github.com/renovate ) in
[https://github.com/mgechev/revive/pull/1358 ](https://redirect.github.com/mgechev/revive/pull/1358 )
- Update rule description URLs to point to revive.run by
[@​volfgox](https://redirect.github.com/volfgox ) in
[https://github.com/mgechev/revive/pull/1360 ](https://redirect.github.com/mgechev/revive/pull/1360 )
- chore: add linter for Markdown files by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1361 ](https://redirect.github.com/mgechev/revive/pull/1361 )
-
fix([#​1367](https://redirect.github.com/mgechev/revive/issues/1367 )):
struct-tag with validate is missing built-in rules by
[@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1368 ](https://redirect.github.com/mgechev/revive/pull/1368 )
- time-date: add rule to check for time.Date usage by
[@​ccoVeille](https://redirect.github.com/ccoVeille ) in
[https://github.com/mgechev/revive/pull/1327 ](https://redirect.github.com/mgechev/revive/pull/1327 )
-
fix([#​1363](https://redirect.github.com/mgechev/revive/issues/1363 )):
package-comments ignores //nolint directives by
[@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1366 ](https://redirect.github.com/mgechev/revive/pull/1366 )
- refactor: removes `get` from getters names by
[@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1373 ](https://redirect.github.com/mgechev/revive/pull/1373 )
- refactor: test utils functions by removing redundant test instructions
parsing and simplifying asserting functions by
[@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1374 ](https://redirect.github.com/mgechev/revive/pull/1374 )
- docs: format code snippets in markdown files by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1324 ](https://redirect.github.com/mgechev/revive/pull/1324 )
- fix: avoid false positive for blank identifier by
[@​ccoVeille](https://redirect.github.com/ccoVeille ) in
[https://github.com/mgechev/revive/pull/1376 ](https://redirect.github.com/mgechev/revive/pull/1376 )
- chore: improve time-date decimal tests by
[@​ccoVeille](https://redirect.github.com/ccoVeille ) in
[https://github.com/mgechev/revive/pull/1378 ](https://redirect.github.com/mgechev/revive/pull/1378 )
- new rule to spot unnecessary use of formatting functions by
[@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1372 ](https://redirect.github.com/mgechev/revive/pull/1372 )
- refactor: enable gocritic linter; fix lint issues by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1375 ](https://redirect.github.com/mgechev/revive/pull/1375 )
- refactor: gofmt testdata by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1379 ](https://redirect.github.com/mgechev/revive/pull/1379 )
- refactor: moves code related to AST from rule.utils into astutils
package by [@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1380 ](https://redirect.github.com/mgechev/revive/pull/1380 )
- feature: Add nil timezone handling detection to time-date rule by
[@​ccoVeille](https://redirect.github.com/ccoVeille ) in
[https://github.com/mgechev/revive/pull/1377 ](https://redirect.github.com/mgechev/revive/pull/1377 )
- chore: enable thelper linter in golangci-lint by
[@​ccoVeille](https://redirect.github.com/ccoVeille ) in
[https://github.com/mgechev/revive/pull/1386 ](https://redirect.github.com/mgechev/revive/pull/1386 )
- chore: enable dupword linter in golangci-lint by
[@​ccoVeille](https://redirect.github.com/ccoVeille ) in
[https://github.com/mgechev/revive/pull/1385 ](https://redirect.github.com/mgechev/revive/pull/1385 )
- chore: enforce American English spelling in golangci-lint by
[@​ccoVeille](https://redirect.github.com/ccoVeille ) in
[https://github.com/mgechev/revive/pull/1384 ](https://redirect.github.com/mgechev/revive/pull/1384 )
- docs: improve comments for functions; enable godot by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1382 ](https://redirect.github.com/mgechev/revive/pull/1382 )
- docs: use contrib.rocks to make contributors section shorter by
[@​alexandear](https://redirect.github.com/alexandear ) in
[https://github.com/mgechev/revive/pull/1381 ](https://redirect.github.com/mgechev/revive/pull/1381 )
- feature: detect time/date out of bounds in time-date rule by
[@​ccoVeille](https://redirect.github.com/ccoVeille ) in
[https://github.com/mgechev/revive/pull/1370 ](https://redirect.github.com/mgechev/revive/pull/1370 )
- refactor: simplifies the implementation of rule call-to-gc by
[@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1388 ](https://redirect.github.com/mgechev/revive/pull/1388 )
- feature: rule use-fmt-print by
[@​chavacava](https://redirect.github.com/chavacava ) in
[https://github.com/mgechev/revive/pull/1389 ](https://redirect.github.com/mgechev/revive/pull/1389 )
#### New Contributors
- [@​miparnisari](https://redirect.github.com/miparnisari ) made
their first contribution in
[https://github.com/mgechev/revive/pull/1340 ](https://redirect.github.com/mgechev/revive/pull/1340 )
- [@​ArjunRajpal123](https://redirect.github.com/ArjunRajpal123 )
made their first contribution in
[https://github.com/mgechev/revive/pull/1346 ](https://redirect.github.com/mgechev/revive/pull/1346 )
- [@​volfgox](https://redirect.github.com/volfgox ) made their
first contribution in
[https://github.com/mgechev/revive/pull/1351 ](https://redirect.github.com/mgechev/revive/pull/1351 )
**Full Changelog**:
https://github.com/mgechev/revive/compare/v1.9.0...v1.10.0
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4zMy42IiwidXBkYXRlZEluVmVyIjoiNDAuNTAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiU2tpcCBDaGFuZ2Vsb2ciLCJkZXBlbmRlbmNpZXMiXX0=-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com >
2025-06-16 12:33:22 -07:00
codeimmortal
a571bc1069
remove internal/matchers ( #6777 )
...
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6523
Remove internal/matchers from code base and its code generation
Co-authored-by: Robert Pająk <pellared@hotmail.com >
Co-authored-by: Damien Mathieu <42@dmathieu.com >
2025-05-22 09:24:32 +02:00
Rabel Mervin
5bf8691520
Functionality moved from internal/attribute to attribute ( #6580 )
...
Resolve #6525
## Description
This pull request addresses the issue of moving internal functionality
from the `internal/attribute` package to the `attribute `package within
the open-telemetry/opentelemetry-go repository. The goal is to ensure
that none of this functionality is added to the public API of the
attribute or any other public package while improving the naming,
layout, and following Go idioms.
## Changes made
1. Moved Functions to `attribute/internal`
- Created a new internal package within the `attribute` package:
`attribute/internal`.
- Moved `attribute.go` and `attribute_test.go` into the
`attribute/internal`
- Moved the following functions from `internal/attribute` to
`attribute/internal`
2 . Changes in .golangci.yml
- Removed line 67 and 68 from .golangci.yml
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2025-04-03 14:12:30 +01:00
Tyler Yahn
7512a2be2e
Add the golines golangci-lint formatter ( #6513 )
...
Ensure consistent line wrapping (<= 120 characters) within the project.
2025-03-30 03:46:44 -07:00
renovate[bot]
590bcee71b
fix(deps): update module github.com/golangci/golangci-lint to v2 ( #6499 )
...
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/golangci/golangci-lint](https://redirect.github.com/golangci/golangci-lint )
| `v1.64.8` -> `v2.0.2` |
[](https://docs.renovatebot.com/merge-confidence/ )
|
[](https://docs.renovatebot.com/merge-confidence/ )
|
[](https://docs.renovatebot.com/merge-confidence/ )
|
[](https://docs.renovatebot.com/merge-confidence/ )
|
---
### Release Notes
<details>
<summary>golangci/golangci-lint
(github.com/golangci/golangci-lint)</summary>
###
[`v2.0.2`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v202 )
[Compare
Source](https://redirect.github.com/golangci/golangci-lint/compare/v2.0.1...v2.0.2 )
1. Misc.
- Fixes flags parsing for formatters
- Fixes the filepath used by the exclusion `source` option
2. Documentation
- Adds a section about flags migration
- Cleaning pages with v1 options
###
[`v2.0.1`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v201 )
[Compare
Source](https://redirect.github.com/golangci/golangci-lint/compare/v2.0.0...v2.0.1 )
1. Linters/formatters bug fixes
- `golines`: fix settings during linter load
2. Misc.
- Validates the `version` field before the configuration
- `forbidigo`: fix migration
###
[`v2.0.0`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v200 )
[Compare
Source](https://redirect.github.com/golangci/golangci-lint/compare/v1.64.8...v2.0.0 )
1. Enhancements
- 🌟 New `golangci-lint fmt` command with dedicated formatter
configuration
(https://golangci-lint.run/welcome/quick-start/#formatting )
- ♻️ New `golangci-lint migrate` command to help migration from v1 to v2
(cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#command-migrate ))
- ⚠️ New default values (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/ ))
- ⚠️ No exclusions by default (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#issuesexclude-use-default ))
- ⚠️ New default sort order (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#outputsort-order ))
- 🌟 New option `run.relative-path-mode` (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#runrelative-path-mode ))
- 🌟 New linters configuration (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#linters ))
- 🌟 New output format configuration (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#output ))
- 🌟 New `--fast-only` flag (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#lintersfast ))
- 🌟 New option `linters.exclusions.warn-unused` to log a warning if an
exclusion rule is unused.
2. New linters/formatters
- Add `golines` formatter https://github.com/segmentio/golines
3. Linters new features
- ⚠️ Merge `staticcheck`, `stylecheck`, `gosimple` into one linter
(`staticcheck`) (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#lintersenablestylecheckgosimplestaticcheck ))
- `go-critic`: from 0.12.0 to 0.13.0
- `gomodguard`: from 1.3.5 to 1.4.1 (block explicit indirect
dependencies)
- `nilnil`: from 1.0.1 to 1.1.0 (new option: `only-two`)
- `perfsprint`: from 0.8.2 to 0.9.1 (checker name in the diagnostic
message)
- `staticcheck`: new `quickfix` set of rules
- `testifylint`: from 1.5.2 to 1.6.0 (new options: `equal-values`,
`suite-method-signature`, `require-string-msg`)
- `wsl`: from 4.5.0 to 4.6.0 (new option: `allow-cuddle-used-in-block`)
4. Linters bug fixes
- `bidichk`: from 0.3.2 to 0.3.3
- `errchkjson`: from 0.4.0 to 0.4.1
- `errname`: from 1.0.0 to 1.1.0
- `funlen`: fix `ignore-comments` option
- `gci`: from 0.13.5 to 0.13.6
- `gosmopolitan`: from 1.2.2 to 1.3.0
- `inamedparam`: from 0.1.3 to 0.2.0
- `intrange`: from 0.3.0 to 0.3.1
- `protogetter`: from 0.3.9 to 0.3.12
- `unparam`: from
[`8a5130c`](https://redirect.github.com/golangci/golangci-lint/commit/8a5130ca722f )
to
[`0df0534`](https://redirect.github.com/golangci/golangci-lint/commit/0df0534333a4 )
5. Misc.
- 🧹 Configuration options renaming (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/ ))
- 🧹 Remove options (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/ ))
- 🧹 Remove flags (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/ ))
- 🧹 Remove alternative names (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/#alternative-linter-names ))
- 🧹 Remove or replace deprecated elements (cf. [Migration
guide](https://golangci-lint.run/product/migration-guide/ ))
- Adds an option to display some commands as JSON:
- `golangci-lint config path --json`
- `golangci-lint help linters --json`
- `golangci-lint help formatters --json`
- `golangci-lint linters --json`
- `golangci-lint formatters --json`
- `golangci-lint version --json`
6. Documentation
- [Migration guide](https://golangci-lint.run/product/migration-guide/ )
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIwNy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJTa2lwIENoYW5nZWxvZyIsImRlcGVuZGVuY2llcyJdfQ==-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com >
2025-03-26 10:46:44 -07:00
Matthieu MOREL
6192b14cba
[chore] clean up revive configuration ( #6353 )
...
Following
https://github.com/open-telemetry/opentelemetry-go/pull/6273#pullrequestreview-2598385186
This clean up revive configuration
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2025-02-25 10:50:19 +01:00
Damien Mathieu
f62232fa1b
Replace tenv with usetesting ( #6313 )
...
The `tenv` linter is deprecated in favor of `usetesting`.
2025-02-13 11:18:37 +01:00
Matthieu MOREL
e98ef1bfdb
[chore]: enable usestdlibvars linter ( #6001 )
...
#### Description
[usestdlibvars](https://golangci-lint.run/usage/linters/#usestdlibvars )
is a linter that detect the possibility to use variables/constants from
the Go standard library.
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2024-11-25 12:02:46 -08:00
Tyler Yahn
99c3c661e0
Use auto-instrumentation SDK in global tracing ( #5920 )
...
When the auto-instrumentation attaches to a process using the global
TracerProvider, and there has not been a delegate set, create a span
from the go.opentelemetry.io/auto/sdk package so the OTel Go
auto-instrumentation can instrument the application by default.
Resolve #5702
### Benchmarks
```terminal
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/internal/global
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
StartEndSpanNoSDK-8 244.2n ± 21% 250.2n ± 23% ~ (p=0.739 n=10)
```
2024-11-21 10:54:58 -08:00
Matthieu MOREL
74937a2952
[chore]: enable all rules of perfsprint ( #5978 )
...
#### Description
[perfsprint](https://github.com/catenacyber/perfsprint ) is a linter for
performance, aiming at usages of fmt.Sprintf which have faster
alternatives.
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-11-18 10:04:50 +01:00
Matthieu MOREL
61e9b35139
[chore]: enable int-conversion rule of perfsprint ( #5964 )
...
[perfsprint](https://github.com/catenacyber/perfsprint ) is a linter for
performance, aiming at usages of fmt.Sprintf which have faster
alternatives.
This PR enables int-conversion rule
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-11-14 19:17:37 +01:00
Robert Pająk
06ee6f2be7
Remove examples ( #5930 )
...
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/5801
Remove all examples under go.opentelemetry.io/otel/example as they are
moved to Contrib repository.
2024-10-31 12:35:14 +01:00
Matthieu MOREL
469f3d7e87
[chore]: enable negative-positive rule from testifylint ( #5849 )
...
Testifylint is a linter that provides best practices with the use of
testify.
This PR enables
[negative-positive](https://github.com/Antonboom/testifylint?tab=readme-ov-file#negative-positive )
rule from [testifylint](https://github.com/Antonboom/testifylint )
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-09-30 08:44:52 +02:00
Matthieu MOREL
6edc7a63df
[chore]: enable expected-actual rule from testifylint ( #5848 )
...
Testifylint is a linter that provides best practices with the use of
testify.
This PR enables
[expected-actual](https://github.com/Antonboom/testifylint?tab=readme-ov-file#expected-actual )
rule from [testifylint](https://github.com/Antonboom/testifylint )
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-09-26 12:04:33 +02:00
Matthieu MOREL
d284a86fa5
[chore]: enable error-nil rule from testifylint ( #5843 )
...
Testifylint is a linter that provides best practices with the use of
testify.
This PR enables
[error-nil](https://github.com/Antonboom/testifylint?tab=readme-ov-file#error-nil )
rule from [testifylint](https://github.com/Antonboom/testifylint )
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
Co-authored-by: Robert Pająk <pellared@hotmail.com >
2024-09-25 11:07:59 +02:00
Matthieu MOREL
62cc0c7441
[chore]: enable error-is-as rule from testifylint ( #5836 )
...
Testifylint is a linter that provides best practices with the use of
testify.
This PR enables
[error-is-as](https://github.com/Antonboom/testifylint?tab=readme-ov-file#error-is-as )
rule from [testifylint](https://github.com/Antonboom/testifylint )
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-09-24 19:17:16 +02:00
Matthieu MOREL
561bd49e6c
[chore]: enable suite-extra-assert-call rule from testifylint ( #5833 )
...
#### Description
Testifylint is a linter that provides best practices with the use of
testify.
This PR enables
[suite-extra-assert-call](https://github.com/Antonboom/testifylint?tab=readme-ov-file#suite-extra-assert-call )
rule from [testifylint](https://github.com/Antonboom/testifylint )
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-09-23 08:56:45 +02:00
Matthieu MOREL
063239fa37
[chore]: enable len and empty rules from testifylint ( #5832 )
...
#### Description
Testifylint is a linter that provides best practices with the use of
testify.
This PR enables
[empty](https://github.com/Antonboom/testifylint?tab=readme-ov-file#empty )
and
[len](https://github.com/Antonboom/testifylint?tab=readme-ov-file#len )
rules from [testifylint](https://github.com/Antonboom/testifylint )
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
2024-09-21 08:04:28 -07:00
Matthieu MOREL
aef9e4fa2f
[chore]: enable bool-compare rule from testifylint ( #5829 )
...
#### Description
Testifylint is a linter that provides best practices with the use of
testify.
This PR enables
[bool-compare](https://github.com/Antonboom/testifylint?tab=readme-ov-file#bool-compare )
rule from [testifylint](https://github.com/Antonboom/testifylint )
It's linter provided by golangci-lint.
Here all available rules are activated except those who require to be
fixed. This PR only fixes bool-compare so the quantity of changes stays
reasonnable for reviewers.
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com >
Co-authored-by: Damien Mathieu <42@dmathieu.com >
2024-09-20 09:39:27 +02:00
Nathan Baulch
506a9baf5e
Fix typos ( #5763 )
2024-09-09 08:53:15 +02:00
Robert Pająk
972c919ea0
[chore] Add bodyclose linter ( #5659 )
...
Add https://golangci-lint.run/usage/linters/#bodyclose linter.
PR in contrib:
https://github.com/open-telemetry/opentelemetry-go-contrib/pull/5962
2024-08-01 07:11:57 +02:00
Robert Pająk
e2b0751cd1
[chore] Add asasalint linter ( #5653 )
...
Add https://golangci-lint.run/usage/linters/#asasalint linter.
Fix the bugs detected by the linter.
PR in Contrib:
https://github.com/open-telemetry/opentelemetry-go-contrib/pull/5957
2024-07-31 08:41:11 +02:00
Damien Mathieu
6d45f283c7
Add errorlint linter ( #5535 )
...
This is the last PR adding missing linters, adding
[errorlint](https://github.com/polyfloyd/go-errorlint ).
Co-authored-by: Sam Xie <sam@samxie.me >
2024-06-25 10:55:00 -07:00
Damien Mathieu
f6a5aa2c3f
Add unparam linter ( #5531 )
...
This adds the [unparam](https://github.com/mvdan/unparam ) linter.
Co-authored-by: Sam Xie <sam@samxie.me >
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2024-06-21 16:02:07 -07:00
Damien Mathieu
3e91436a3b
Add unconvert linter ( #5529 )
...
This adds the unconvert linter, and fixes every new issue related to it.
Co-authored-by: Sam Xie <sam@samxie.me >
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2024-06-21 15:00:26 -07:00
Damien Mathieu
ef848afa30
Add tenv linter ( #5524 )
...
This starts adding more linters we aren't currently using, based on the
ones used by [the
collector](https://github.com/open-telemetry/opentelemetry-collector/blob/main/.golangci.yml#L122-L139 ).
This linter does not currently have any issues, so it requires no
further changes.
I'll be opening other PRs for linters that do require fixes.
* [tenv](https://github.com/sivchari/tenv ) requires using `t.Setenv`
rather than `os.Setenv` in tests.
---------
Co-authored-by: Sam Xie <sam@samxie.me >
2024-06-20 08:54:51 -07:00
Anton Manakin
c719117f22
[chore] add log package to depguard linter ( #5463 )
...
Closes #5458
Adding `log` packages to depguard to avoid using cross-module internal
packages.
2024-06-03 18:13:48 +02:00
Robert Pająk
5b28921940
[chore] Add gosec via golangci-lint ( #4645 )
2023-10-19 08:47:07 +02:00
Tyler Yahn
5dff273a1e
Use gofumpt instead of gofmt ( #4623 )
...
* Use gofumpt instead of gofmt in golangci-lint conf
* Run gofumpt fixes
* Format generated templates
---------
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com >
2023-10-16 10:02:21 -07:00
Tyler Yahn
e528731853
Remove the deprecated internal exporters/otlp* packages ( #4469 )
...
* Remove the deprecated otlpmetric/internal pkg
* Remove the deprecated otlp/internal pkg
* Remove the deprecated otlptrace/internal pkg
* Remove the deprecated otlptrace/internal/envconfig pkg
* Remove the deprecated otlptrace/internal/otlpconfig pkg
* Remove the deprecated otlptrace/internal/otlptracetest pkg
* Remove the deprecated otlptrace/internal/retry pkg
* Add changelog entry
* Remove dependabot entries
* Remove versions.yaml entry
* Run go mod tidy
* Remove linter override for removed pkgs
* Run crosslink
2023-08-29 14:08:07 -07:00
Tyler Yahn
7b9fb7ac87
Add lint to check for known cross-module internal packages ( #4426 )
...
* Add depguard conf for cross-mod internal pkg check
* Apply feedback
* Apply suggestions from code review
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com >
2023-08-11 07:35:02 -07:00
dependabot[bot]
bb867e6a4e
Bump github.com/golangci/golangci-lint from 1.52.2 to 1.53.2 in /internal/tools ( #4177 )
...
* Bump github.com/golangci/golangci-lint in /internal/tools
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint ) from 1.52.2 to 1.53.2.
- [Release notes](https://github.com/golangci/golangci-lint/releases )
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md )
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.52.2...v1.53.2 )
---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
* Update golangci lint configuration
---------
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com >
2023-06-04 07:54:38 -07:00
Charlie Le
8dcabc3ef9
feat(ci): Add codespell to Makefile and GitHub Actions ( #3996 )
...
* feat(ci): Add codespell to Makefile and GitHub Actions
This is a followup from
https://github.com/open-telemetry/opentelemetry-go/pull/3980 to add the
automation for checking for code spelling errors to a different PR.
[Codespell][] makes use of the `.codespellrc` file automatically as a config
file for convenience. The configuration file specifies directories and
flags to pass to `codespell`. Codespell also makes use of the
`.codespellignore` file to ignore certain word spellings.
There is a new section in `Makefile` for installing python tooling.
It is similar to how the go tools are installed. It sets up a virtualenv
in `venv `and installs python tooling there if it hasn't been installed
yet.
The new [codespell workflow][] will run in pull requests to annotate
misspelled words. It is set up to only warn the user with annotations in
the pull request if there are typos, but we can fail the pull request as
well if we want to by deleting the [warn_only][] key.
[codespell]: https://github.com/codespell-project/codespell
[codespell workflow]: https://github.com/codespell-project/actions-codespell
[warn_only]: https://github.com/codespell-project/actions-codespell#parameter-only_warn
* Use docker to run python and codespell
Since this is a Go project, having a dependency on python seemed
disconcerting. So, docker is used to create a virtual environment
with a python image and also run the tools that were installed.
* Remove wording on requirement for python
* Apply suggestions from code review
Co-authored-by: Damien Mathieu <42@dmathieu.com >
* Pin versions into requirements.txt
* Pin version in requirements.txt
* Fix typo in license
* Revert typo fix on deleted file
* Update .github/workflows/codespell.yaml
Co-authored-by: Robert Pająk <pellared@hotmail.com >
* Update codespell.yaml
* Update codespell.yaml
---------
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com >
Co-authored-by: Damien Mathieu <42@dmathieu.com >
Co-authored-by: Robert Pająk <pellared@hotmail.com >
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2023-05-18 09:06:27 -07:00
Tyler Yahn
65ebe5e50f
Add embedded private method interfaces in metric API ( #3916 )
...
* PoC of embedded private method ifaces
* Rename embed to embedded
* Add an embedded iface for all instruments
* Fix metric/instrument tests
* Fix global and otel
* Fix SDK
* Comment the embedded pkg types
* Update the embedded pkg docs
* Update otel/metric docs about impls
* Update otel/metric type docs on impl
* Update docs in otel/metric/instrument on default
* Add changes to changelog
* Apply suggestions from code review
Co-authored-by: Robert Pająk <pellared@hotmail.com >
* Apply feedback on URLs
* Reword based on feedback
* Make it clear we only recommended embedding noop
* Ignore links with godot linter
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com >
2023-04-03 07:33:19 -07:00
Aaron Clawson
6dccc07388
Disables context-as-argument linter ( #3385 )
...
This is currently incompatible with viper v1.13.0. Status for the linter found at
https://github.com/golangci/golangci-lint/issues/3280
2022-11-03 15:18:45 -07:00
Tyler Yahn
c8a13d6302
Remove deprecated golangci linters ( #3409 )
...
The "deadcode", "structcheck", and "varcheck" linters are deprecated by
golangci-lint. It is recommended by that project to use "unused"
instead. The "unused" linter is already enabled, so this just removes
the deprecated linters.
2022-10-31 08:41:26 -05:00
Tyler Yahn
1f5b159161
Use already enabled revive linter and add depguard ( #2883 )
...
* Refactor golangci-lint conf
Order settings alphabetically.
* Add revive settings to golangci conf
* Check blank imports
* Check bool-literal-in-expr
* Check constant-logical-expr
* Check context-as-argument
* Check context-key-type
* Check deep-exit
* Check defer
* Check dot-imports
* Check duplicated-imports
* Check early-return
* Check empty-block
* Check empty-lines
* Check error-naming
* Check error-return
* Check error-strings
* Check errorf
* Stop ignoring context first arg in tests
* Check exported comments
* Check flag-parameter
* Check identical branches
* Check if-return
* Check increment-decrement
* Check indent-error-flow
* Check deny list of go imports
* Check import shadowing
* Check package comments
* Check range
* Check range val in closure
* Check range val address
* Check redefines builtin id
* Check string-format
* Check struct tag
* Check superfluous else
* Check time equal
* Check var naming
* Check var declaration
* Check unconditional recursion
* Check unexported return
* Check unhandled errors
* Check unnecessary stmt
* Check unnecessary break
* Check waitgroup by value
* Exclude deep-exit check in example*_test.go files
2022-05-19 15:15:07 -05:00
Tyler Yahn
fdfc821bac
Add godot linter to golangci ( #2845 )
...
Comment should be complete sentences outside of lists with sentence
fragments. This adds the godot linter to check these complete sentences
end with punctuation. If they do not, running fix will append a period.
2022-04-25 13:22:49 -07:00
Tyler Yahn
25827f01aa
Lock down golangci-lint config ( #2602 )
...
Disable all default linters prior to enabling the ones we want to ensure
that no upgrade that include new default linters introduce changes to
the CI system.
2022-02-14 11:09:41 -06:00
Anderson Queiroz
7a0cee7b3a
Replaces golint by revive and fix newly reported linter issues ( #1946 )
...
* replaces golint by revive and fix newly reported linter issues
* add pull request ID to CHANGELOG.md
* Update internal/matchers/temporal_matcher.go
Co-authored-by: Robert Pająk <pellared@hotmail.com >
* fix pull request issues
* explains why the linter is disabled
* Update semconv/http.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
* Update metric/unit/unit.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
* restores 'example/passthrough/go.sum' to original state
* fix after rebase
* export ErrInvalidAsyncRunner again and add nolint
* Update trace/tracestate.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
* Update sdk/metric/sdk.go
Co-authored-by: Aaron Clawson <Aaron.Clawson@gmail.com >
* Fix ContextWithoutBaggage comment
* Fix SpanEndOption comment
Co-authored-by: Robert Pająk <pellared@hotmail.com >
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
Co-authored-by: Aaron Clawson <Aaron.Clawson@gmail.com >
Co-authored-by: Tyler Yahn <codingalias@gmail.com >
2021-06-08 10:10:01 -07:00
Tyler Yahn
5d9472beab
Remove nolint and update misspell to ignore cancelled
2020-05-29 11:11:19 -07:00
Edward Muller
9f03360a84
Enable golint & gofmt, resolve issues ( #214 )
...
* Add golint to linters and resolve issues.
I decided to remove constructors for some of the propagation types
because the constructors can be reduced to either using the zero value
or a single, non optional member.
* Enable gofmt and commit fixes
2019-10-16 10:24:38 -07:00