Skip to content

Commit

Permalink
go/analysis/passes/composite: allow InternalFuzzTarget
Browse files Browse the repository at this point in the history
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 <rfindley@google.com>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Trust: Jamal Carvalho <jamal@golang.org>
Trust: Michael Matloob <matloob@golang.org>
  • Loading branch information
abhinav authored and findleyr committed Mar 14, 2022
1 parent 198cae3 commit 49d48a0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
16 changes: 16 additions & 0 deletions go/analysis/passes/composite/testdata/src/a/a_fuzz_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2022 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.

//go:build go1.18
// +build go1.18

package a

import "testing"

var fuzzTargets = []testing.InternalFuzzTarget{
{"Fuzz", Fuzz},
}

func Fuzz(f *testing.F) {}
9 changes: 5 additions & 4 deletions go/analysis/passes/composite/whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ var unkeyedLiteral = map[string]bool{
"unicode.Range16": true,
"unicode.Range32": true,

// These three structs are used in generated test main files,
// These four structs are used in generated test main files,
// but the generator can be trusted.
"testing.InternalBenchmark": true,
"testing.InternalExample": true,
"testing.InternalTest": true,
"testing.InternalBenchmark": true,
"testing.InternalExample": true,
"testing.InternalTest": true,
"testing.InternalFuzzTarget": true,
}

0 comments on commit 49d48a0

Please sign in to comment.