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

all: rewrite interface{} to any #49884

Closed
griesemer opened this issue Nov 30, 2021 · 14 comments
Closed

all: rewrite interface{} to any #49884

griesemer opened this issue Nov 30, 2021 · 14 comments
Assignees
Labels
NeedsFix release-blocker
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Nov 30, 2021

Reminder issue.

@griesemer griesemer added NeedsFix release-blocker labels Nov 30, 2021
@griesemer griesemer added this to the Go1.18 milestone Nov 30, 2021
@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Nov 30, 2021

The type checker preserves the difference between interface{} and any (it keeps track of the alias in this case, like it does for byte and uint8), so tests that rely on printing interface{} as "interface{}" must remain unchanged. And so should tests in testdata directories.

@griesemer griesemer changed the title all: rewrite "interface{}" to "any" all: rewrite interface{} to any Nov 30, 2021
@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Nov 30, 2021

@findleyr Please comment here once you're satisfied with the handling of any in the importers.

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 1, 2021

Change https://golang.org/cl/368254 mentions this issue: all: gofmt -w -r 'interface{} -> any' src

@AlphaHot
Copy link

@AlphaHot AlphaHot commented Dec 2, 2021

No, please don't do that. I'm used to the interface{}.

@ii64

This comment has been minimized.

@kostyaBro
Copy link

@kostyaBro kostyaBro commented Dec 7, 2021

What problem does this solve? Can you describe?

It also seems to me to break backward compatibility.

@cristaloleg
Copy link

@cristaloleg cristaloleg commented Dec 7, 2021

No, it doesn't break backward compatibility, see original issue/proposal. any is just an alias for interface{}.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 7, 2021

This is not the issue, nor the time, to debate allowing any. This issue is about tracking certain work. Regarding allowing any at all, we had the proposal discussion, and the proposal was accepted. See #33232 (comment) for the rationale. No one is raising any new information that would warrant reopening the decision.

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 7, 2021

Change https://golang.org/cl/369955 mentions this issue: go/internal/gcimporter: fix test for Go 1.18 any

gopherbot pushed a commit to golang/tools that referenced this issue Dec 7, 2021
In Go 1.18 context uses any, not interface{}.
Fix the test in a way that should work for both older and newer versions.

For golang/go#49884.

Change-Id: Ib8690876c6a9364b98f9c7ba739b953a8d7565d4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/369955
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@gopherbot
Copy link

@gopherbot gopherbot commented Dec 8, 2021

Change https://golang.org/cl/370294 mentions this issue: internal/lsp: normalize interface{} to any in test comparisons

gopherbot pushed a commit to golang/tools that referenced this issue Dec 9, 2021
The switch to use any in standard library signatures breaks many of our
tests that match signature strings exactly. Fix this by normalizing
strings to use 'any' in place of interface{}, before comparing.

Updates golang/go#49884

Change-Id: If18ce1035b3206f37d7de6e584cf2c2cae9481c5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/370294
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
@toothrot
Copy link
Contributor

@toothrot toothrot commented Dec 13, 2021

Friendly check-in here, this is one of the last two issues blocking the beta of 1.18. Has there been an update recently?

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 13, 2021

Change https://golang.org/cl/371297 mentions this issue: net/http: revert h2_bundle.go formatting change from CL 368254

gopherbot pushed a commit that referenced this issue Dec 13, 2021
h2_bundle.go is automatically generated from x/net/http2. Any
formatting changes within that file need to be first made upstream.

This brings the contents of h2_bundle.go back in line with the
upstream generator, fixing the cmd/internal/moddeps test that is
currently failing on the longtest builders.

For #49884

Change-Id: I5757240b77e250e0026b8a52a0e867e1578ec2d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/371297
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@seankhliao
Copy link
Contributor

@seankhliao seankhliao commented Dec 14, 2021

Do doc comments need to be updated or are they fine to be left as interface{} ?

@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Dec 14, 2021

@seankhliao This is issue is closed. Please continue this discussion elsewhere.

That said: it depends. Simply replacing interface{} with any may lead to grammatically incorrect or funny sounding prose. It probably takes some tuning to get right.

But again, please discuss this elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix release-blocker
Projects
None yet
Development

No branches or pull requests

9 participants