diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f1de139..2f00dd63 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: [1.15.x, 1.16.x] + go-version: [1.16.x, 1.17.x] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/go.mod b/go.mod index 07e2c3c4..ef958134 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/rogpeppe/go-internal -go 1.15 +go 1.16 require ( github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e diff --git a/testscript/exe.go b/testscript/exe.go index fa048c71..1be7d0f6 100644 --- a/testscript/exe.go +++ b/testscript/exe.go @@ -15,7 +15,6 @@ import ( "path/filepath" "runtime" "strings" - "testing" ) // TestingM is implemented by *testing.M. It's defined as an interface @@ -228,7 +227,7 @@ func runCoverSubcommand(cprof string, mainf func() int) (exitCode int) { // Run MainStart (recursively, but it we should be ok) with no tests // so that it writes the coverage profile. - m := testing.MainStart(nopTestDeps{}, nil, nil, nil) + m := mainStart() if code := m.Run(); code != 0 && exitCode == 0 { exitCode = code } diff --git a/testscript/exe_go118.go b/testscript/exe_go118.go new file mode 100644 index 00000000..dae0fcfc --- /dev/null +++ b/testscript/exe_go118.go @@ -0,0 +1,49 @@ +//go:build go1.18 + +package testscript + +import ( + "reflect" + "testing" + "time" +) + +func mainStart() *testing.M { + return testing.MainStart(nopTestDeps{}, nil, nil, nil, nil) +} + +// Note: corpusEntry is an anonymous struct type used by some method stubs. +type corpusEntry = struct { + Parent string + Name string + Data []byte + Values []interface{} + Generation int + IsSeed bool +} + +// Note: CoordinateFuzzing was added in Go 1.18. +func (nopTestDeps) CoordinateFuzzing(time.Duration, int64, time.Duration, int64, int, []corpusEntry, []reflect.Type, string, string) error { + return nil +} + +// Note: RunFuzzWorker was added in Go 1.18. +func (nopTestDeps) RunFuzzWorker(func(corpusEntry) error) error { + return nil +} + +// Note: ReadCorpus was added in Go 1.18. +func (nopTestDeps) ReadCorpus(string, []reflect.Type) ([]corpusEntry, error) { + return nil, nil +} + +// Note: CheckCorpus was added in Go 1.18. +func (nopTestDeps) CheckCorpus([]interface{}, []reflect.Type) error { + return nil +} + +// Note: ResetCoverage was added in Go 1.18. +func (nopTestDeps) ResetCoverage() {} + +// Note: SnapshotCoverage was added in Go 1.18. +func (nopTestDeps) SnapshotCoverage() {} diff --git a/testscript/exe_pre_go1.18.go b/testscript/exe_pre_go1.18.go new file mode 100644 index 00000000..b859f467 --- /dev/null +++ b/testscript/exe_pre_go1.18.go @@ -0,0 +1,11 @@ +//go:build !go1.18 + +package testscript + +import ( + "testing" +) + +func mainStart() *testing.M { + return testing.MainStart(nopTestDeps{}, nil, nil, nil) +}