Skip to content

Commit b65e259

Browse files
rscgopherbot
authored andcommitted
internal/fuzz: write shorter testdata corpus file names
The only purpose of using the SHA256 in the file name is collision avoidance. Using just the first 64 bits (16 hex digits) will be more than enough, unless people start storing billions of test cases in their corpora. The shorter names are nicer for just about everything: command lines, repository listings, and so on. Change-Id: I67c760023bed85ba3ffd4f8058f86ef778322ba7 Reviewed-on: https://go-review.googlesource.com/c/go/+/443335 TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Russ Cox <[email protected]> Reviewed-by: Peter Weinberger <[email protected]> Run-TryBot: Russ Cox <[email protected]>
1 parent d5ba1d8 commit b65e259

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/internal/fuzz/fuzz.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ func CheckCorpus(vals []any, types []reflect.Type) error {
10321032
// writeToCorpus will not rewrite it. writeToCorpus sets entry.Path to the new
10331033
// file that was just written or an error if it failed.
10341034
func writeToCorpus(entry *CorpusEntry, dir string) (err error) {
1035-
sum := fmt.Sprintf("%x", sha256.Sum256(entry.Data))
1035+
sum := fmt.Sprintf("%x", sha256.Sum256(entry.Data))[:16]
10361036
entry.Path = filepath.Join(dir, sum)
10371037
if err := os.MkdirAll(dir, 0777); err != nil {
10381038
return err

0 commit comments

Comments
 (0)