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

cmd/vet: check for misused of append onto new, non-empty slice #6840

Open
bradfitz opened this issue Nov 27, 2013 · 2 comments
Open

cmd/vet: check for misused of append onto new, non-empty slice #6840

bradfitz opened this issue Nov 27, 2013 · 2 comments
Labels
Milestone

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Nov 27, 2013

Request from coworkers:

Govet or lint could warn about appends to slices which were made with a length (but not
a capacity) and had no intervening mutations:

   s := make([]Foo, len(m))   // accidental length; user meant capacity: make([]Foo, 0, len(m))
   for k, v := range m {
      ....
      s = append(s, foo)
   }
@rsc

This comment has been minimized.

Copy link
Contributor

@rsc rsc commented Dec 4, 2013

Comment 1:

Labels changed: added repo-tools.

@rsc

This comment has been minimized.

Copy link
Contributor

@rsc rsc commented Mar 3, 2014

Comment 2:

Adding Release=None to all Priority=Someday bugs.

Labels changed: added release-none.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/govet: check for misused of append onto new, non-empty slice x/tools/cmd/govet: check for misused of append onto new, non-empty slice Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@ALTree ALTree changed the title x/tools/cmd/govet: check for misused of append onto new, non-empty slice cmd/vet: check for misused of append onto new, non-empty slice Aug 10, 2017
@dominikh dominikh mentioned this issue Feb 4, 2020
5 of 27 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.