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

Reflect package for protobuf values #67169

Closed
Rajan-226 opened this issue May 4, 2024 · 4 comments
Closed

Reflect package for protobuf values #67169

Rajan-226 opened this issue May 4, 2024 · 4 comments

Comments

@Rajan-226
Copy link

Go version

go 1.21

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='arm64'
GOBIN='/Users/rajan.sharma/go/bin'
GOCACHE='/Users/rajan.sharma/Library/Caches/go-build'
GOENV='/Users/rajan.sharma/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/rajan.sharma/go/pkg/mod'
GONOPROXY='github.com/razorpay/*'
GONOSUMDB='github.com/razorpay/*'
GOOS='darwin'
GOPATH='/Users/rajan.sharma/go'
GOPRIVATE='github.com/razorpay/*'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/opt/go/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/opt/go/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/rajan.sharma/go/src/github.com/razorpay/payments-upi/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/w3/_vyqyy610p934gd5vy_jnygr0000gq/T/go-build1777294655=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

I want to compare two structpb.Value using reflect.DeepEqual.

It's giving false if I try to print one of the structpb.Value before comparing them.
https://go.dev/play/p/yedwyZQzAP1

It's working fine if we don't have a print statement before comparing both.
https://go.dev/play/p/x9WhvnjvoPJ

And if we print both structpb.Value, then also code gives equal on comparison.
https://go.dev/play/p/iBB6l8mBXcs

I'm aware proto.Equal is able to compare them regardless of printing. But wanted to understand if this is a bug that after using print statement, code is giving false for comparison.

What did you see happen?

https://go.dev/play/p/yedwyZQzAP1
true
false

What did you expect to see?

https://go.dev/play/p/yedwyZQzAP1
true
true

@seankhliao
Copy link
Member

this appears to be a question about protobuf's internal representation.

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale May 4, 2024
@Rajan-226
Copy link
Author

@seankhliao But I feel this is a bug only where we are seeing unexpected results due to a print statement?

@seankhliao
Copy link
Member

golang/protobuf#1339

@Rajan-226
Copy link
Author

Thanks a lot @seankhliao for pinging this 🙌🏼 , Though the answer is still unclear over there, I'll try to dig deep into this.

Also, it would be really great if you could share some tips/reference to find existing similar GitHub issues so that I can follow before raising any issue next time. Anything apart from searching keywords related to issue on google?

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