]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/load: improve comments
authorsivchari <shibuuuu5@gmail.com>
Tue, 1 Aug 2023 05:00:52 +0000 (05:00 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 29 Jan 2024 17:22:52 +0000 (17:22 +0000)
isTestFunc checked whether the parameter type is B, M or T before the version of Go1.17.
But, after Go1.18, isTestFunc checks F, too.

Change-Id: I30bc97c2b8f2974bc9ae4df2f32dc8dce760d7d6
GitHub-Last-Rev: 507d5b1f74b2f2d0a75d61fe169cc0cc40d132c0
GitHub-Pull-Request: golang/go#56127
Reviewed-on: https://go-review.googlesource.com/c/go/+/441835
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/go/internal/load/test.go

index d09ababfdda4cf6135bcab3d44c7402390cc1a16..3135805905b8501b38c15afc8e31beadf5df1849 100644 (file)
@@ -564,7 +564,7 @@ func recompileForTest(pmain, preal, ptest, pxtest *Package) *PackageError {
 }
 
 // isTestFunc tells whether fn has the type of a testing function. arg
-// specifies the parameter type we look for: B, M or T.
+// specifies the parameter type we look for: B, F, M or T.
 func isTestFunc(fn *ast.FuncDecl, arg string) bool {
        if fn.Type.Results != nil && len(fn.Type.Results.List) > 0 ||
                fn.Type.Params.List == nil ||
@@ -579,7 +579,7 @@ func isTestFunc(fn *ast.FuncDecl, arg string) bool {
        // We can't easily check that the type is *testing.M
        // because we don't know how testing has been imported,
        // but at least check that it's *M or *something.M.
-       // Same applies for B and T.
+       // Same applies for B, F and T.
        if name, ok := ptr.X.(*ast.Ident); ok && name.Name == arg {
                return true
        }