Skip to content
This repository was archived by the owner on May 9, 2021. It is now read-only.

Conversation

@dominikh
Copy link
Member

@dominikh dominikh commented Mar 13, 2016

for _ = range and for _, _ = range can be written as
for range instead.

`for _ = range` and `for _, _ = range` can be written as `for range`
instead.
@dsymonds
Copy link
Contributor

Thanks, but I'm not convinced this is particularly useful. for _ = range was the only option for so long and is only able to be shortened relatively recently, so it's hard to argue that the shorter form is stylistically dominant.

@dominikh
Copy link
Member Author

"relatively recently" was over a year ago. I was hoping that adding the check would remind people that this is now possible. I think most people don't realize that it is.

It's something that gofmt -s simplifies (just like for x, _ := range), so it seemed to fit in for symmetry's sake.

@dsymonds
Copy link
Contributor

A year isn't much time in the scheme of things to make something a standard. Go has been a public project for over 6 years. Mere availability of a language construct does not make it stylistically wrong to use the longer form, and it's not golint's place to remind people of new features, only to flag poor style.

Sorry, this doesn't pass muster.

@dominikh
Copy link
Member Author

Fair enough. I'll be back in a year ;-)

@dominikh dominikh closed this Mar 14, 2016
@louwers
Copy link

louwers commented Mar 15, 2017

@dominikh Here we are.

@dominikh
Copy link
Member Author

I am impressed. PTAL

@dominikh dominikh reopened this Mar 15, 2017
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@andybons
Copy link
Member

@dominikh can you reply to @googlebot ?

@dominikh
Copy link
Member Author

I signed it.

@andybons
Copy link
Member

@googlebot cla?

@andybons
Copy link
Member

Hm. @googlebot seems stuck. Can you confirm with your existing CLA data and verify that your email is set on your git commits? Links in #196 (comment)

@dominikh
Copy link
Member Author

I think I see what happened. I had signed the CLA on my gmail account a long time ago, and added my main email (dominik@honnef.co) as an alternate email address. A while back, I turned dominik@honnef.co into a Google Apps account, so it must've detached the address from the CLA.

I have now effectively signed a second CLA, on the new account.

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@gopherbot
Copy link

This PR (HEAD: 318343f) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/#/c/lint/+/96176 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link

Message from Andrew Bonventre:

Patch Set 1: Code-Review+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/96176.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Andrew Bonventre:

Patch Set 1:

(1 comment)

ping adonovan


Please don’t reply on this GitHub thread. Visit golang.org/cl/96176.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Alan Donovan:

Patch Set 1: Code-Review+2


Please don’t reply on this GitHub thread. Visit golang.org/cl/96176.
After addressing review feedback, remember to publish your drafts!

@andybons andybons changed the title Suggest for range when possible golint: suggest for range when possible Mar 1, 2018
@gopherbot
Copy link

Message from Gerrit Bot:

Uploaded patch set 2: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/96176.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Gerrit Bot:

Uploaded patch set 3: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/96176.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Mar 1, 2018
for _ = range and for _, _ = range can be written as
for range instead.

Change-Id: I6d5e7aecce941260f4a4de294685f99d9ff48c09
GitHub-Last-Rev: 318343f
GitHub-Pull-Request: #196
Reviewed-on: https://go-review.googlesource.com/96176
Reviewed-by: Alan Donovan <adonovan@google.com>
@gopherbot
Copy link

This PR is being closed because golang.org/cl/96176 has been merged.

@gopherbot gopherbot closed this Mar 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants