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
Analysis Issues related to static analysis (vet, x/tools/go/analysis) NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@bradfitz
Copy link
Contributor

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
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 1:

Labels changed: added repo-tools.

@rsc
Copy link
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 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
@ALTree ALTree added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Sep 26, 2019
@odeke-em odeke-em self-assigned this Jun 6, 2020
@adonovan adonovan added the Analysis Issues related to static analysis (vet, x/tools/go/analysis) label Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

5 participants