// TestMain executes the test binary as the vet command if // GO_VETTEST_IS_VET is set, and runs the tests otherwise. func TestMain(m *testing.M) { … } // vetPath returns the path to the "vet" binary to run. func vetPath(t testing.TB) string { … } func vetCmd(t *testing.T, arg, pkg string) *exec.Cmd { … } func TestVet(t *testing.T) { … } func cgoEnabled(t *testing.T) bool { … } func errchk(c *exec.Cmd, files []string, t *testing.T) { … } // TestTags verifies that the -tags argument controls which files to check. func TestTags(t *testing.T) { … } // errorCheck matches errors in outStr against comments in source files. // For each line of the source files which should generate an error, // there should be a comment of the form // ERROR "regexp". // If outStr has an error for a line which has no such comment, // this function will report an error. // Likewise if outStr does not have an error for a line which has a comment, // or if the error message does not match the <regexp>. // The <regexp> syntax is Perl but it's best to stick to egrep. // // Sources files are supplied as fullshort slice. // It consists of pairs: full path to source file and its base name. func errorCheck(outStr string, wantAuto bool, fullshort ...string) (err error) { … } func splitOutput(out string, wantAuto bool) []string { … } // matchPrefix reports whether s starts with file name prefix followed by a :, // and possibly preceded by a directory name. func matchPrefix(s, prefix string) bool { … } func partitionStrings(prefix string, strs []string) (matched, unmatched []string) { … } type wantedError … var errRx … var errAutoRx … var errQuotesRx … var lineRx … // wantedErrors parses expected errors from comments in a file. func wantedErrors(file, short string) (errs []wantedError) { … }