mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
go/token, syscall: annotate if blocks that defeat vet's unreachable pass
Since putting code in an "if true" block is unusual, make it easier for readers to understand the purpose of doing this. For #73998. Change-Id: I3fd8d65130211c7c01d424366a3c662482d80add Reviewed-on: https://go-review.googlesource.com/c/go/+/702416 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
9650c97d0f
commit
f327a05419
2 changed files with 3 additions and 3 deletions
|
|
@ -325,7 +325,7 @@ func (t *tree) set(file *File, pos **node, parent *node) {
|
|||
// This code path isn't currently needed
|
||||
// because FileSet never updates an existing entry.
|
||||
// Remove this assertion if things change.
|
||||
if true {
|
||||
if true { // defeat vet's unreachable pass
|
||||
panic("unreachable according to current FileSet requirements")
|
||||
}
|
||||
x.file = file
|
||||
|
|
@ -346,7 +346,7 @@ func (t *tree) delete(pos **node) {
|
|||
// This code path isn't currently needed because FileSet
|
||||
// only calls delete after a positive locate.
|
||||
// Remove this assertion if things change.
|
||||
if true {
|
||||
if true { // defeat vet's unreachable pass
|
||||
panic("unreachable according to current FileSet requirements")
|
||||
}
|
||||
return
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ func TestClearenv(t *testing.T) {
|
|||
defer func() {
|
||||
ret = recover()
|
||||
}()
|
||||
if true {
|
||||
if true { // defeat vet's unreachable pass
|
||||
panic(nil)
|
||||
}
|
||||
return "should not return"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue