Commit Graph

9 Commits

Author SHA1 Message Date
Alex Boten fbffbb0820
[chore] small test improvements (#11211)
Clean up some inconsistencies in the test code across the components.

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
2024-09-18 13:47:25 -07:00
Matthieu MOREL 0e22dc367f
[chore]: enable error-is-as rule from testifylint (#11146)
#### Description

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-11 14:54:47 -07:00
Daniel Jaglowski 654cb24073
Add ability to marshal yaml-tagged structs (#10282)
Possible solution for
https://github.com/open-telemetry/opentelemetry-collector/pull/10139#issuecomment-2117559390

More thorough explanation here:
https://github.com/open-telemetry/opentelemetry-collector/pull/10139#issuecomment-2142728782

---------

Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
2024-06-17 09:02:44 -07:00
Evan Bradley 3a75fbb7f4
[confmap] Encode string-like map keys (#10137)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Our check for determining whether a map key can be encoded as a string
is too restrictive and doesn't into account types which are essentially
aliases for the string type and don't implement `UnmarshalText`.

I encountered this while trying to call
`(confmap.Conf).Marshal(*otelcol.Config)` when the config includes a
Prometheus receiver, which includes the [LabelName
type](https://github.com/prometheus/common/blob/main/model/labels.go#L98)
that does not implement an unmarshaling method. We can't guarantee that
all types will implement this, and [Go's print formatters
check](https://github.com/golang/go/blob/master/src/fmt/print.go#L803)
whether `(reflect.Value).Kind()` equals `reflect.String`, so I think
this will be an overall more robust approach.

<!--Describe what testing was performed and which tests were added.-->
#### Testing

I added two test cases to demonstrate when we will hit this case.

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
2024-05-15 17:24:56 +02:00
Antoine Toulme 62beec3590
[confmap] use github.com/go-viper/mapstructure/v2 (#9634)
**Description:**
Update mapstructure to use a maintained fork,
github.com/go-viper/mapstructure/v2.
See https://github.com/mitchellh/mapstructure/issues/349 for context

**Link to tracking Issue:**
#9161 

Creating this as WIP to see if all tests pass.
2024-02-27 11:52:31 -08:00
Alex Boten 80d704deb4
[chore] use license shortform (#7694)
* [chore] use license shortform

To remain consistent w/ contrib repo, see https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/22052

Signed-off-by: Alex Boten <aboten@lightstep.com>

* make goporto

Signed-off-by: Alex Boten <aboten@lightstep.com>

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-05-18 13:11:17 -07:00
Alex Boten 8b27d6b467
[chore] add license-check (#7589)
Cleaning up the license files, and updating `checklicense` to verify the contents of the license as per the `opentelemetry-go-build-tools` repo.

---------

Signed-off-by: Alex Boten <aboten@lightstep.com>
2023-05-03 08:53:47 -07:00
Bogdan Drutu a2f0153679
[chore] replace the usage of interface{} with any (#7053)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-01-30 15:01:25 -08:00
Jeffrey Chien e9311f6af5
Add config marshaler. (#5566) 2022-09-29 16:15:47 -07:00