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

Build failure when upgrading to client_golang v1.20.4 #3143

Closed
blahspam opened this issue Oct 2, 2024 · 1 comment
Closed

Build failure when upgrading to client_golang v1.20.4 #3143

blahspam opened this issue Oct 2, 2024 · 1 comment

Comments

@blahspam
Copy link

blahspam commented Oct 2, 2024

Host operating system: output of uname -a

Darwin xxxxxxx 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64 arm Darwin

node_exporter version: output of node_exporter --version

v1.8.2

node_exporter command line flags

n/a

node_exporter log output

n/a

Are you running node_exporter in Docker?

No.

What did you do that produced an error?

Building a small support package that has requires both

github.com/prometheus/client_golang v1.19.0
github.com/prometheus/node_exporter v1.8.2

Upgrading client_golang to v1.20.4 causes compilation errors when building for linux/amd64:

$ GOOS=linux GOARCH=amd64 go build ./...
# github.com/prometheus/node_exporter/collector
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:83: cannot use host.Name (variable of type *string) as string value in argument to prometheus.MustNewConstMetric
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:94: cannot use host.Speed (variable of type *string) as string value in argument to prometheus.MustNewConstMetric
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:106: cannot use host.PortState (variable of type *string) as string value in argument to prometheus.MustNewConstMetric
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:122: cannot use host.PortType (variable of type *string) as string value in argument to prometheus.MustNewConstMetric
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:137: cannot use host.PortID (variable of type *string) as string value in argument to prometheus.MustNewConstMetric
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:150: cannot use host.PortName (variable of type *string) as string value in argument to prometheus.MustNewConstMetric
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:165: cannot use host.FabricName (variable of type *string) as string value in argument to prometheus.MustNewConstMetric
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:182: cannot use host.SymbolicName (variable of type *string) as string value in argument to prometheus.MustNewConstMetric
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:201: cannot use host.SupportedClasses (variable of type *string) as string value in argument to prometheus.MustNewConstMetric
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:224: cannot use host.SupportedSpeeds (variable of type *string) as string value in argument to prometheus.MustNewConstMetric
../../go/pkg/mod/github.com/prometheus/[email protected]/collector/fibrechannel_linux.go:117:224: too many errors

I believe this was resolved by #3059. I am able to build against the latest revision.

Any chance we can get a patch release that includes the above fix?

What did you expect to see?

No errors

What did you see instead?

See above

@dswarbrick
Copy link
Contributor

It's not the fact that you upgraded client_golang to v1.20.4 which is causing the build failure. It's highly likely that when you run go mod tidy, it is surreptitiously bumping the procfs dependency to v0.15.1, which will cause a build failure since it contains some backwards-incompatible changes.

You can "pin" the procfs version to v0.14.0, which is compatible with node_exporter v1.8.2, by adding this to your go.mod:

replace github.com/prometheus/procfs v0.15.1 => github.com/prometheus/procfs v0.14.0

Alternatively, build against a newer version of node_exporter (i.e., HEAD, since v1.8.2 is the most current release), which as you know properly supports procfs v0.15.1.

@blahspam blahspam closed this as completed Oct 8, 2024
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

No branches or pull requests

2 participants