Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use reflect.Value.IsZero #297

Merged
merged 1 commit into from
Jun 6, 2022
Merged

Use reflect.Value.IsZero #297

merged 1 commit into from
Jun 6, 2022

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Jun 6, 2022

Now that Go 1.13 is the minimum version, we can use the reflect.Value.IsZero
method instead of our own internal/value.IsZero function.
Interestingly, our IsZero function pre-dates the IsZero method,
but fortunately has the exact same semantics, since both are targetting
semantics defined by the Go language specification.

Now that Go 1.13 is the minimum version, we can use the reflect.Value.IsZero
method instead of our own internal/value.IsZero function.
Interestingly, our IsZero function pre-dates the IsZero method,
but fortunately has the exact same semantics, since both are targetting
semantics defined by the Go language specification.
@dsnet dsnet requested a review from neild June 6, 2022 17:07
@dsnet
Copy link
Collaborator Author

dsnet commented Jun 6, 2022

I like code deletion. It's when I feel most productive.

@dsnet
Copy link
Collaborator Author

dsnet commented Jun 6, 2022

Bleh. GitHub actions is confused. It's hosed on trying to test for Go 1.11 and 1.12 when we have removed those from our CI.

@neild Can you force merge this?

@dnephin
Copy link

dnephin commented Jun 6, 2022

It looks like github actions it not running tests for 1.11/1.12, but those checks are marked as "required" in project settings.

That can be fixed under project settings: https://github.com/google/go-cmp/settings/branches, under "Require status checks to pass before merging"

@neild neild merged commit a53d7e0 into master Jun 6, 2022
@neild
Copy link
Collaborator

neild commented Jun 6, 2022

Fixed the branch settings to no longer check for 1.11/1.12.

@dsnet dsnet deleted the dsnet/iszero branch June 6, 2022 17:34
@pmaloogoogle
Copy link

pmaloogoogle commented Jun 8, 2022

hi,
This change seems to have broken us. we are running go get github.com/google/go-cmp/cmp as a step in Dockerfile to build an image. Wanted to check if you have any recommendations on how to move forward. Thanks.

Error:

Step 7/11 : RUN go get github.com/google/go-cmp/cmp
---> Running in 39675da5c0fb
github.com/google/go-cmp/cmp
src/github.com/google/go-cmp/cmp/report_compare.go:249:29: r.Value.ValueX.IsZero undefined (type reflect.Value has no field or method IsZero)
src/github.com/google/go-cmp/cmp/report_compare.go:249:56: r.Value.ValueY.IsZero undefined (type reflect.Value has no field or method IsZero)
src/github.com/google/go-cmp/cmp/report_compare.go:251:29: r.Value.ValueX.IsZero undefined (type reflect.Value has no field or method IsZero)
src/github.com/google/go-cmp/cmp/report_compare.go:253:29: r.Value.ValueY.IsZero undefined (type reflect.Value has no field or method IsZero)
src/github.com/google/go-cmp/cmp/report_reflect.go:187:9: vv.IsZero undefined (type reflect.Value has no field or method IsZero)
The command '/bin/sh -c go get github.com/google/go-cmp/cmp' returned a non-zero code: 2

@dsnet
Copy link
Collaborator Author

dsnet commented Jun 8, 2022

What version of Go are you using? The minimally supported version of Go by this package is Go 1.13.

The reflect.Value.IsZero method was added in Go 1.13: https://go.dev/doc/go1.13#reflect

@pmaloogoogle
Copy link

Thanks for your reply. We are installing golang in a previous step using the following cmd - apt-get update && apt-get install -y golang

@pmaloogoogle
Copy link

go version returns go version go1.10.4 linux/amd64

@pmaloogoogle
Copy link

we will plan to update to go 1.13. Thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants