Skip to content

Commit

Permalink
Update test main template to match current version in Go 1.8.
Browse files Browse the repository at this point in the history
See golang/go@c56cc9b?w=1.

Fixes the following issue when running gopherjs test:

	_testmain.go:162:25: cannot use matchString (value of type func(pat string, str string) (result bool, err error)) as testing.testDeps value in argument to testing.MainStart: missing method MatchString
  • Loading branch information
dmitshur committed Feb 16, 2017
1 parent 0ff5023 commit bc37a63
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,8 @@ import (
{{if not .TestMain}}
"os"
{{end}}
"regexp"
"testing"
"testing/internal/testdeps"
{{if .ImportTest}}
{{if .NeedTest}}_test{{else}}_{{end}} {{.Package.ImportPath | printf "%q"}}
Expand Down Expand Up @@ -948,22 +948,8 @@ var examples = []testing.InternalExample{
{{end}}
}
var matchPat string
var matchRe *regexp.Regexp
func matchString(pat, str string) (result bool, err error) {
if matchRe == nil || matchPat != pat {
matchPat = pat
matchRe, err = regexp.Compile(matchPat)
if err != nil {
return
}
}
return matchRe.MatchString(str), nil
}
func main() {
m := testing.MainStart(matchString, tests, benchmarks, examples)
m := testing.MainStart(testdeps.TestDeps{}, tests, benchmarks, examples)
{{with .TestMain}}
{{.Package}}.{{.Name}}(m)
{{else}}
Expand Down

0 comments on commit bc37a63

Please sign in to comment.