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: update interface{} to any #770

Open
mvndaai opened this issue Apr 26, 2023 · 2 comments
Open

Go: update interface{} to any #770

mvndaai opened this issue Apr 26, 2023 · 2 comments
Labels
lang:go The Go language

Comments

@mvndaai
Copy link

mvndaai commented Apr 26, 2023

After go.1.18 you can use any and interface{} are interchangeably.

I would love the change so when I do a ctrl+F and look for styles around how interfaces should work I don't get false positives.

The style guide already prefers the use.

I would just want the examples here updated

@adityakode
Copy link

Hey! I am new here . Can you ps help and tell me what should be updated and with what?

@mvndaai
Copy link
Author

mvndaai commented May 7, 2023

Change https://github.com/google/styleguide/blob/gh-pages/go/decisions.md?plain=1#L2981

func IsNotNil(t *testing.T, name string, val interface{}) {

to

func IsNotNil(t *testing.T, name string, val any) {

Change these two

https://github.com/google/styleguide/blob/gh-pages/go/best-practices.md?plain=1#L1258
https://github.com/google/styleguide/blob/gh-pages/go/best-practices.md?plain=1#L1275

func Sprintf(format string, data ...interface{}) string

to

func Sprintf(format string, data ...any) string

adityapatil37 added a commit to adityapatil37/styleguide that referenced this issue Jun 23, 2023
@vapier vapier added the lang:go The Go language label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:go The Go language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants