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

Fix use of reflect.StringHeader in prometheus/metric.go #133

Merged
merged 4 commits into from
Aug 12, 2021

Conversation

bhavanki
Copy link
Contributor

The go vet command in Go 1.16 reports a warning for inappropriate
use of reflect.StringHeader.

golang/go#40701

Its use in prometheus/metric.go to convert a byte array to a string in
place began to trigger the warning. That code has been replaced with a
safer variant that avoids the vet warning and still converts the array
without allocating new memory.

https://stackoverflow.com/a/66865482

The `go vet` command in Go 1.16 reports a warning for inappropriate
use of reflect.StringHeader.

golang/go#40701

Its use in prometheus/metric.go to convert a byte array to a string in
place began to trigger the warning. That code has been replaced with a
safer variant that avoids the `vet` warning and still converts the array
without allocating new memory.

https://stackoverflow.com/a/66865482
The 2.x influxdb Docker images require authentication to use. This
changes pins tests back to the 1.x family.
@bhavanki
Copy link
Contributor Author

The additional commit here gets CircleCI testing for the influxdb part of this library working again.

Copy link
Contributor

@Pryz Pryz left a comment

Choose a reason for hiding this comment

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

LGTM! thanks for adding these tests as well :)

@bhavanki
Copy link
Contributor Author

LGTM! thanks for adding these tests as well :)

Credit to @collinvandyck for that!

prometheus/metric.go Show resolved Hide resolved
prometheus/metric_test.go Show resolved Hide resolved
@bhavanki bhavanki merged commit bed3e79 into master Aug 12, 2021
@bhavanki bhavanki deleted the fix-stringheader-for-vet branch August 12, 2021 18:58
kevinburkesegment pushed a commit that referenced this pull request Sep 9, 2024
The `go vet` command in Go 1.16 reports a warning for inappropriate
use of reflect.StringHeader.

golang/go#40701

Its use in prometheus/metric.go to convert a byte array to a string in
place began to trigger the warning. That code has been replaced with a
safer variant that avoids the `vet` warning and still converts the array
without allocating new memory.

https://stackoverflow.com/a/66865482

Additionally, the CircleCI test now uses a pinned influxdb image of
1.8.9. The 2.x influxdb Docker images require authentication to use.

Co-authored-by: Collin Van Dyck <collin@segment.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 this pull request may close these issues.

3 participants