frebib / nzbget-exporter

NZBGet Prometheus metrics exporter
20 stars 5 forks source link

Fails to build with go 1.18 #3

Closed adamcstephens closed 2 years ago

adamcstephens commented 2 years ago
 ---> 797f8654cc02
Step 9/14 : RUN go generate &&     go build         -v         -ldflags="-w -s -X 'main.Version=$EXPORTER_VER'"         -o /nzbget_exporter
 ---> Running in 5cbc3f5d8364
enumerx: internal error: package "sort" without types was imported from "net"
history.go:76: running "enumerx": exit status 1

I was able to get it to build with 1.17.

I can pull request a pin to the Dockerfile if you'd like, but changing to tag 1.17-alpine was sufficient for me.

frebib commented 2 years ago

This seems to be related to enumerx having outdated golang.org/x/tools dependencies. See https://github.com/alvaroloes/enumer/issues/65

If I clone github.com/niktri/enumerx and bump the deps, then it works

frebib@frebib-PC /t/tmp.sUd4ovlo> go get -u                                                             
go: downloading golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8
go: upgraded golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd => v0.0.0-20220319134239-a9b59b0215f8
go: upgraded golang.org/x/tools v0.0.0-20201005185003-576e169c3de7 => v0.1.10
frebib@frebib-PC /t/tmp.sUd4ovlo> go install
...
frebib@frebib-PC ~/n/p/f/nzbget-exporter> go generate
frebib@frebib-PC ~/n/p/f/nzbget-exporter> go build
frebib@frebib-PC ~/n/p/f/nzbget-exporter> go version nzbget-exporter 
nzbget-exporter: go1.18
frebib commented 2 years ago

If this gets merged, it should be fixed. If not I can fork the tool and update the reference to it https://github.com/niktri/enumerx/pull/1

adamcstephens commented 2 years ago

Thank you. :)