1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-11-24 08:22:25 +02:00
Commit Graph

18 Commits

Author SHA1 Message Date
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
Koichi Shiraishi
887748491b Add vanity import name (#107)
* api: add doc.go and vanity custom import name

* experimental/streaming/exporter: add doc.go & vanity custom import name

* experimental/streaming/exporter/*: add vanity custom import name

* golangci.yml: fix local-prefixes to go.opentelemetry.io

* api,sdk: run `goimports -w -local go.opentelemetry.io`
2019-08-26 09:41:15 -07:00
Edward Muller
99906da7a6 Misc Makefile and README.md updates (#78)
Enabling misspell and goimports in golangci-lint allows a bit of
simplification of tools.go / Makefile.

The linters enabled locally also complained about the markdown in
README.md a little, so I fixed those complaints.

I also enabled auto-fix mode in golangci-lint so that it will just
fix any lint issues it runs across (which is how goimports/misspell)
was being used.

misspell still needs to be included in tools.go unless we decide that
we didn't want it to run on markdown files.
2019-08-05 13:58:24 -07:00
Edward Muller
063035e9e0 Add goimports and golangci-lint (#17)
goimports for import rewritting
golangci-lint as the configurable linting swiss army knife.

These tools are recorded in [tools.go](https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module). This records
them as a dependency to make sure we're all using the same tool versions.

To make sure this project's tool's versions don't stomp over versions
from other projects, they are installed in ./.tools, which is
.gitignored.

goimports was run and fixed up a single file:
plugin/httptrace/httptrace.go

I prefer to group local packages below external packages, hence the use
of goimports -local option.

.golangci.yml contains nothing but an incomplete set of defaults ATM.
I expect those to change over time though. ;-)

To use, run:

$ make precommit

Fixes #15
2019-06-18 17:09:49 -07:00