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

Comments

Projects
None yet
2 participants
@bradfitz
Member

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.

Contributor

rsc commented Dec 4, 2013

Comment 1:

Labels changed: added repo-tools.

@rsc

This comment has been minimized.

Contributor

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 from cmd/govet: check for misused of append onto new, non-empty slice to 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 from x/tools/cmd/govet: check for misused of append onto new, non-empty slice to cmd/vet: check for misused of append onto new, non-empty slice Aug 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment