Open reimgun opened 2 years ago
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)
@kakkoyun any update on this ?
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 .
@reimgun Sorry, I dropped the ball on this. I'll keep the tab open to take care of this. Thanks for further investigation.
I came across which might be the root cause https://github.com/prometheus/common/issues/381#issuecomment-1290267963
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 https://github.com/golang/protobuf/issues/1133#issuecomment-629376146 cc: @kakkoyun)
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 usingGO111MODULE=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/golang_protobuf_extensions@v1.0.2: 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
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
here the full jenkins job output:
i have tried it also as recommended from go but this also not work:
and just in case you came again with this solution: https://github.com/prometheus/client_golang/issues/1154
this doesn`t help: