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:
Dmitri Shuralyov 2025-09-10 10:55:19 -04:00 committed by Gopher Robot
parent 9650c97d0f
commit f327a05419
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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"