Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd: add a new analyzer for check missing values after append
If there is no second parameter added during append, there will be no prompt when executing go vet. Add an analyzer to detect this situation Update #60448 Change-Id: If9848835424f310c54e3e9377aaaad4a1516871a Reviewed-on: https://go-review.googlesource.com/c/go/+/498416 Run-TryBot: shuang cui <imcusg@gmail.com> Run-TryBot: Tim King <taking@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Tim King <taking@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
- Loading branch information
1 parent
e9379a8
commit dc523c8
Showing
7 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/appends/appends.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/appends/doc.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2023 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// This file contains tests for the appends checker. | ||
|
||
package appends | ||
|
||
func AppendsTest() { | ||
sli := []string{"a", "b", "c"} | ||
sli = append(sli) // ERROR "append with no values" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters