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

go get -v github.com/prometheus/client_golang/prometheus does not #1169

Open
reimgun opened this issue Nov 11, 2022 · 7 comments
Open

go get -v github.com/prometheus/client_golang/prometheus does not #1169

reimgun opened this issue Nov 11, 2022 · 7 comments
Labels

Comments

@reimgun
Copy link

reimgun commented Nov 11, 2022

go version: 1.19.2

i receive the following error message on command:
go env -w GO111MODULE=off; go get -v github.com/prometheus/client_golang/prometheus

#15 28.71 ../github.com/prometheus/common/expfmt/decode.go:89:38: cannot use v (variable of type *io_prometheus_client.MetricFamily) as type protoreflect.ProtoMessage in argument to pbutil.ReadDelimited:
#15 28.71 	*io_prometheus_client.MetricFamily does not implement protoreflect.ProtoMessage (missing ProtoReflect method)
#15 28.71 ../github.com/prometheus/common/expfmt/encode.go:120:40: cannot use v (variable of type *io_prometheus_client.MetricFamily) as type protoreflect.ProtoMessage in argument to pbutil.WriteDelimited:
#15 28.71 	*io_prometheus_client.MetricFamily does not implement protoreflect.ProtoMessage (missing ProtoReflect method)

here the full jenkins job output:

#15 3.226 + go env -w GO111MODULE=off
#15 3.229 + go get -v github.com/prometheus/client_golang/prometheus
#15 3.232 github.com/prometheus/client_golang (download)
#15 4.839 github.com/beorn7/perks (download)
#15 5.520 github.com/cespare/xxhash (download)
#15 6.170 github.com/golang/protobuf (download)
#15 8.937 get "google.golang.org/protobuf/encoding/prototext": found meta tag vcs.metaImport{Prefix:"google.golang.org/protobuf", VCS:"git", RepoRoot:"https://go.googlesource.com/protobuf"} at //google.golang.org/protobuf/encoding/prototext?go-get=1
#15 8.937 get "google.golang.org/protobuf/encoding/prototext": verifying non-authoritative meta tag
#15 9.080 google.golang.org/protobuf (download)
#15 10.87 get "google.golang.org/protobuf/encoding/protowire": found meta tag vcs.metaImport{Prefix:"google.golang.org/protobuf", VCS:"git", RepoRoot:"https://go.googlesource.com/protobuf"} at //google.golang.org/protobuf/encoding/protowire?go-get=1
#15 10.87 get "google.golang.org/protobuf/encoding/protowire": verifying non-authoritative meta tag
#15 11.00 get "google.golang.org/protobuf/reflect/protoreflect": found meta tag vcs.metaImport{Prefix:"google.golang.org/protobuf", VCS:"git", RepoRoot:"https://go.googlesource.com/protobuf"} at //google.golang.org/protobuf/reflect/protoreflect?go-get=1
#15 11.00 get "google.golang.org/protobuf/reflect/protoreflect": verifying non-authoritative meta tag
#15 11.14 get "google.golang.org/protobuf/proto": found meta tag vcs.metaImport{Prefix:"google.golang.org/protobuf", VCS:"git", RepoRoot:"https://go.googlesource.com/protobuf"} at //google.golang.org/protobuf/proto?go-get=1
#15 11.14 get "google.golang.org/protobuf/proto": verifying non-authoritative meta tag
#15 11.28 get "google.golang.org/protobuf/reflect/protoregistry": found meta tag vcs.metaImport{Prefix:"google.golang.org/protobuf", VCS:"git", RepoRoot:"https://go.googlesource.com/protobuf"} at //google.golang.org/protobuf/reflect/protoregistry?go-get=1
#15 11.28 get "google.golang.org/protobuf/reflect/protoregistry": verifying non-authoritative meta tag
#15 11.41 get "google.golang.org/protobuf/runtime/protoiface": found meta tag vcs.metaImport{Prefix:"google.golang.org/protobuf", VCS:"git", RepoRoot:"https://go.googlesource.com/protobuf"} at //google.golang.org/protobuf/runtime/protoiface?go-get=1
#15 11.41 get "google.golang.org/protobuf/runtime/protoiface": verifying non-authoritative meta tag
#15 11.55 get "google.golang.org/protobuf/reflect/protodesc": found meta tag vcs.metaImport{Prefix:"google.golang.org/protobuf", VCS:"git", RepoRoot:"https://go.googlesource.com/protobuf"} at //google.golang.org/protobuf/reflect/protodesc?go-get=1
#15 11.55 get "google.golang.org/protobuf/reflect/protodesc": verifying non-authoritative meta tag
#15 11.68 get "google.golang.org/protobuf/runtime/protoimpl": found meta tag vcs.metaImport{Prefix:"google.golang.org/protobuf", VCS:"git", RepoRoot:"https://go.googlesource.com/protobuf"} at //google.golang.org/protobuf/runtime/protoimpl?go-get=1
#15 11.68 get "google.golang.org/protobuf/runtime/protoimpl": verifying non-authoritative meta tag
#15 11.69 github.com/prometheus/client_model (download)
#15 12.44 get "google.golang.org/protobuf/types/known/timestamppb": found meta tag vcs.metaImport{Prefix:"google.golang.org/protobuf", VCS:"git", RepoRoot:"https://go.googlesource.com/protobuf"} at //google.golang.org/protobuf/types/known/timestamppb?go-get=1
#15 12.44 get "google.golang.org/protobuf/types/known/timestamppb": verifying non-authoritative meta tag
#15 12.45 github.com/prometheus/common (download)
#15 13.63 github.com/matttproud/golang_protobuf_extensions (download)
#15 14.27 github.com/prometheus/procfs (download)
#15 15.65 get "golang.org/x/sys/unix": found meta tag vcs.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at //golang.org/x/sys/unix?go-get=1
#15 15.65 get "golang.org/x/sys/unix": verifying non-authoritative meta tag
#15 15.79 golang.org/x/sys (download)
#15 18.46 google.golang.org/protobuf/internal/set
#15 18.46 google.golang.org/protobuf/internal/flags
#15 18.48 github.com/beorn7/perks/quantile
#15 18.48 google.golang.org/protobuf/internal/pragma
#15 18.48 github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
#15 18.48 github.com/cespare/xxhash
#15 18.48 crypto/sha1
#15 18.56 google.golang.org/protobuf/internal/detrand
#15 18.56 github.com/prometheus/procfs/internal/util
#15 18.56 google.golang.org/protobuf/internal/version
#15 18.57 github.com/prometheus/procfs/internal/fs
#15 18.57 github.com/prometheus/common/model
#15 18.66 golang.org/x/sys/unix
#15 18.66 net
#15 18.76 google.golang.org/protobuf/internal/errors
#15 18.87 google.golang.org/protobuf/encoding/protowire
#15 19.06 google.golang.org/protobuf/reflect/protoreflect
#15 19.58 google.golang.org/protobuf/internal/descopts
#15 19.58 google.golang.org/protobuf/internal/encoding/messageset
#15 19.58 google.golang.org/protobuf/internal/descfmt
#15 19.58 google.golang.org/protobuf/runtime/protoiface
#15 19.58 google.golang.org/protobuf/internal/strs
#15 19.58 google.golang.org/protobuf/internal/order
#15 19.58 google.golang.org/protobuf/internal/genid
#15 19.77 google.golang.org/protobuf/reflect/protoregistry
#15 19.86 google.golang.org/protobuf/internal/encoding/text
#15 20.57 google.golang.org/protobuf/proto
#15 20.77 google.golang.org/protobuf/internal/encoding/defval
#15 21.38 google.golang.org/protobuf/encoding/prototext
#15 21.38 google.golang.org/protobuf/internal/filedesc
#15 21.38 github.com/matttproud/golang_protobuf_extensions/pbutil
#15 21.78 vendor/golang.org/x/net/http/httpproxy
#15 21.78 net/textproto
#15 21.78 crypto/x509
#15 21.86 github.com/prometheus/procfs
#15 22.36 vendor/golang.org/x/net/http/httpguts
#15 22.36 mime/multipart
#15 22.67 google.golang.org/protobuf/internal/encoding/tag
#15 22.86 google.golang.org/protobuf/internal/impl
#15 23.57 crypto/tls
#15 25.78 net/http/httptrace
#15 25.81 net/http
#15 25.92 google.golang.org/protobuf/internal/filetype
#15 26.06 google.golang.org/protobuf/runtime/protoimpl
#15 26.10 google.golang.org/protobuf/types/known/timestamppb
#15 26.10 google.golang.org/protobuf/types/descriptorpb
#15 26.18 github.com/golang/protobuf/ptypes/timestamp
#15 26.50 google.golang.org/protobuf/reflect/protodesc
#15 26.88 github.com/golang/protobuf/proto
#15 27.67 github.com/prometheus/client_model/go
#15 28.07 github.com/prometheus/client_golang/prometheus/internal
#15 28.68 expvar
#15 28.68 github.com/prometheus/common/expfmt
#15 28.71 # github.com/prometheus/common/expfmt
#15 28.71 ../github.com/prometheus/common/expfmt/decode.go:89:38: cannot use v (variable of type *io_prometheus_client.MetricFamily) as type protoreflect.ProtoMessage in argument to pbutil.ReadDelimited:
#15 28.71 	*io_prometheus_client.MetricFamily does not implement protoreflect.ProtoMessage (missing ProtoReflect method)
#15 28.71 ../github.com/prometheus/common/expfmt/encode.go:120:40: cannot use v (variable of type *io_prometheus_client.MetricFamily) as type protoreflect.ProtoMessage in argument to pbutil.WriteDelimited:
#15 28.71 	*io_prometheus_client.MetricFamily does not implement protoreflect.ProtoMessage (missing ProtoReflect method)

i have tried it also as recommended from go but this also not work:

#15 2.146 + go env -w GO111MODULE=on
#15 2.149 + go install github.com/prometheus/client_golang/prometheus@latest
#15 2.226 go: downloading github.com/prometheus/client_golang v1.13.0
#15 2.275 go: github.com/prometheus/client_golang/prometheus@latest (in github.com/prometheus/[email protected]):
#15 2.275 	The go.mod file for the module providing named packages contains one or
#15 2.275 	more exclude directives. It must not contain directives that would cause
#15 2.275 	it to be interpreted differently than if it were the main module.

and just in case you came again with this solution: #1154

this doesn`t help:

root@866a2fe8fad6:/go/src/camunda-engine-prometheus-exporter# GO111MODULE=off go get -v github.com/prometheus/client_golang
github.com/prometheus/client_golang (download)
package github.com/prometheus/client_golang: no Go files in /go/src/github.com/prometheus/client_golang
@Flyalay
Copy link

Flyalay commented Nov 14, 2022

i have the same issue.

# github.com/prometheus/common/expfmt prometheus/common/expfmt/decode.go:89:34: cannot use v (type *io_prometheus_client.MetricFamily) as type protoreflect.ProtoMessage in argument to pbutil.ReadDelimited: *io_prometheus_client.MetricFamily does not implement protoreflect.ProtoMessage (missing ProtoReflect method) prometheus/common/expfmt/encode.go:120:36: cannot use v (type *io_prometheus_client.MetricFamily) as type protoreflect.ProtoMessage in argument to pbutil.WriteDelimited: *io_prometheus_client.MetricFamily does not implement protoreflect.ProtoMessage (missing ProtoReflect method)

@reimgun
Copy link
Author

reimgun commented Dec 12, 2022

@kakkoyun any update on this ?

@reimgun
Copy link
Author

reimgun commented Dec 22, 2022

it seems to be working with the following commands:
go env -w GO111MODULE=on
git clone https://github.com/prometheus/client_golang
cd /go/src/client_golang
cp main.go .
go build -a -installsuffix cgo -o /app/publish .

@kakkoyun
Copy link
Member

kakkoyun commented Jan 4, 2023

@reimgun Sorry, I dropped the ball on this. I'll keep the tab open to take care of this. Thanks for further investigation.

@mwiede
Copy link

mwiede commented Jan 10, 2023

I came across which might be the root cause prometheus/common#381 (comment)

@keremgocen
Copy link

keremgocen commented Jan 13, 2023

hey @reimgun, manually changing your dependency version for github.com/matttproud/golang_protobuf_extensions from v1.0.3 => v.1.0.2 seems to be working for me when using GO111MODULE=on. Not quite sure how you'd do the same when not using modules though (maybe someone else can help on that, manually change what you have installed at your GOPATH etc).

go build . fails with the default/latest v1.0.3 and I can repro the error about *io_prometheus_client.MetricFamily does not implement protoreflect.ProtoMessage (missing ProtoReflect method). Looks like a dependency issue.

(ps: this also looks related golang/protobuf#1133 (comment) cc: @kakkoyun)

@puneet336
Copy link

puneet336 commented Apr 30, 2023

manually changing your dependency version for github.com/matttproud/golang_protobuf_extensions from v1.0.3 => v.1.0.2 seems to be working for me when using GO111MODULE=on.

I am using go 1.20.3
could you please share the steps you followed to fix this issue?

in go.mod of v1.5.0 i have changed

require (
...
        github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect

to

require (
...
        github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect

a) when i use go build ,i get this -

[puneets@den-l-081]~/client_golang-1.15.0>ls
api           CODE_OF_CONDUCT.md  Dockerfile  go.mod  LICENSE         Makefile         NOTICE      README.md  SECURITY.md
CHANGELOG.md  CONTRIBUTING.md     examples    go.sum  MAINTAINERS.md  Makefile.common  prometheus  scripts    VERSION
go build .
no Go files in /home/puneets/27042023/nodeexporters/lsfnodeexporter/client_golang-1.15.0

b) when i run make i get following error -

>make
fatal: not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
>> checking code style
>> checking license header
>> running golangci-lint
go list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
go: downloading google.golang.org/protobuf v1.30.0
go: downloading github.com/prometheus/procfs v0.9.0
go: downloading github.com/golang/protobuf v1.5.3
go: downloading github.com/prometheus/common v0.42.0
go: downloading github.com/cespare/xxhash/v2 v2.2.0
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: downloading golang.org/x/oauth2 v0.5.0
go: downloading golang.org/x/net v0.7.0
go: downloading golang.org/x/sys v0.6.0
go: downloading golang.org/x/text v0.7.0
go: github.com/matttproud/[email protected]: missing go.sum entry; to add it:
        go mod download github.com/matttproud/golang_protobuf_extensions
make: *** [common-lint] Error 1

figured out go.sum values from https://github.com/google/cadvisor/blob/master/go.sum
so after replacing lines in go.sum

github.com/matttproud/golang_protobuf_extensions v1.0.2 h1:hAHbPm5IJGijwng3PWk09JkG9WeqChjprR5s9bBZ+OM=
github.com/matttproud/golang_protobuf_extensions v1.0.2/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=

triggerring make gives me -

go: downloading golang.org/x/oauth2 v0.5.0
go: downloading github.com/jpillora/backoff v1.0.0
go: downloading golang.org/x/sys v0.6.0
go: downloading golang.org/x/text v0.7.0
go: updates to go.mod needed; to update it:
        go mod tidy
make: *** [common-lint] Error 1

go: updates to go.mod needed; to update it:
        go mod tidy
make: *** [common-lint] Error 1

@dosubot dosubot bot added the stale label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants