Skip to content

Commit 49d48a0

Browse files
abhinavfindleyr
authored andcommitted
go/analysis/passes/composite: allow InternalFuzzTarget
Add InternalFuzzTarget to the allowlist for the composites analyzer. Other testing-internal struct types produced by the testmain generator are already in there. Fixes golang/go#51623 Change-Id: Ibf91d476ea781c97835157973efc97ce0f987665 Reviewed-on: https://go-review.googlesource.com/c/tools/+/391875 Reviewed-by: Robert Findley <[email protected]> Trust: Robert Findley <[email protected]> Run-TryBot: Robert Findley <[email protected]> TryBot-Result: Gopher Robot <[email protected]> gopls-CI: kokoro <[email protected]> Trust: Jamal Carvalho <[email protected]> Trust: Michael Matloob <[email protected]>
1 parent 198cae3 commit 49d48a0

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2022 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
//go:build go1.18
6+
// +build go1.18
7+
8+
package a
9+
10+
import "testing"
11+
12+
var fuzzTargets = []testing.InternalFuzzTarget{
13+
{"Fuzz", Fuzz},
14+
}
15+
16+
func Fuzz(f *testing.F) {}

go/analysis/passes/composite/whitelist.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ var unkeyedLiteral = map[string]bool{
2626
"unicode.Range16": true,
2727
"unicode.Range32": true,
2828

29-
// These three structs are used in generated test main files,
29+
// These four structs are used in generated test main files,
3030
// but the generator can be trusted.
31-
"testing.InternalBenchmark": true,
32-
"testing.InternalExample": true,
33-
"testing.InternalTest": true,
31+
"testing.InternalBenchmark": true,
32+
"testing.InternalExample": true,
33+
"testing.InternalTest": true,
34+
"testing.InternalFuzzTarget": true,
3435
}

0 commit comments

Comments
 (0)