From cef6b804e2908ba2819894fa1401c165167f898e Mon Sep 17 00:00:00 2001 From: Hariom Verma Date: Fri, 1 Sep 2023 04:18:13 +0530 Subject: [PATCH] Fix review comments --- gnovm/cmd/gno/test.go | 2 +- gnovm/cmd/gno/util.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gnovm/cmd/gno/test.go b/gnovm/cmd/gno/test.go index b5170c1bc07..85fe3f7ee7d 100644 --- a/gnovm/cmd/gno/test.go +++ b/gnovm/cmd/gno/test.go @@ -182,7 +182,7 @@ func execTest(cfg *testCfg, args []string, io *commands.IO) error { cfg.rootDir = guessRootDir() } - paths, err := targetFromPatterns(args) + paths, err := targetsFromPatterns(args) if err != nil { return fmt.Errorf("list targets from patterns: %w", err) } diff --git a/gnovm/cmd/gno/util.go b/gnovm/cmd/gno/util.go index 41a6b2fa281..73ee0f0323b 100644 --- a/gnovm/cmd/gno/util.go +++ b/gnovm/cmd/gno/util.go @@ -106,11 +106,11 @@ func gnoPackagesFromArgs(args []string) ([]string, error) { return paths, nil } -// targetFromPatterns returns a list of target paths that match the patterns. +// targetsFromPatterns returns a list of target paths that match the patterns. // Each pattern can represent a file or a directory, and if the pattern -// includes `/...“, it signifies a directory search. +// includes "/...", the "..." is treated as a wildcard, matching any string. // Intended to be used by gno commands such as `gno test`. -func targetFromPatterns(patterns []string) ([]string, error) { +func targetsFromPatterns(patterns []string) ([]string, error) { paths := []string{} for _, p := range patterns { var match func(string) bool @@ -174,8 +174,8 @@ func targetFromPatterns(patterns []string) ([]string, error) { // name matches pattern. Pattern is a limited glob // pattern in which '...' means 'any string' and there // is no other special syntax. -// Stolen from the go tool -// Taken from: https://github.com/rogpeppe/showdeps/blob/master/showdeps.go +// Simplified version of go source's matchPatternInternal +// (see $GOROOT/src/cmd/internal/pkgpattern) func matchPattern(pattern string) func(name string) bool { re := regexp.QuoteMeta(pattern) re = strings.Replace(re, `\.\.\.`, `.*`, -1)