From 6dd6868dec921b0250d4f6b13be173a02b2a5e6e Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 14 Dec 2021 15:07:20 -0800 Subject: [PATCH] Support go1.18, drop support for 4 } func main() { @@ -88,11 +87,11 @@ func main() { tests, examples, hasMain := findTests(flag.Args()) d := data{ - Package: *pkg, - Tests: tests, - Examples: examples, - HasMain: hasMain, - MainStartTakesInterface: mainStartTakesInterface(), + Package: *pkg, + Tests: tests, + Examples: examples, + HasMain: hasMain, + MainStartTakesFuzzers: mainStartTakesFuzzers(), } err := testMainTmpl.Execute(buf, d) @@ -114,8 +113,10 @@ import ( {{if not .HasMain}} "os" {{end}} + "reflect" "regexp" "testing" + "time" pkg "{{.Package}}" ) @@ -185,11 +186,44 @@ func (matchString) SetPanicOnExit0(bool) { panic("shouldn't get here") } +func (matchString) CoordinateFuzzing(time.Duration, int64, time.Duration, int64, int, []corpusEntry, []reflect.Type, string, string) error { + panic("shouldn't get here") +} + +func (matchString) RunFuzzWorker(func(corpusEntry) error) error { + panic("shouldn't get here") +} + +func (matchString) ReadCorpus(string, []reflect.Type) ([]corpusEntry, error) { + panic("shouldn't get here") +} + +func (matchString) CheckCorpus([]interface{}, []reflect.Type) error { + panic("shouldn't get here") +} + +func (matchString) ResetCoverage() { + panic("shouldn't get here") +} + +func (matchString) SnapshotCoverage() { + panic("shouldn't get here") +} + +type corpusEntry = struct { + Parent string + Path string + Data []byte + Values []interface{} + Generation int + IsSeed bool +} + func main() { -{{if .MainStartTakesInterface}} - m := testing.MainStart(matchString{}, t, nil, e) +{{if .MainStartTakesFuzzers }} + m := testing.MainStart(matchString{}, t, nil, nil, e) {{else}} - m := testing.MainStart(MatchString, t, nil, e) + m := testing.MainStart(matchString{}, t, nil, e) {{end}} {{if .HasMain}} pkg.TestMain(m)