scripts: go_srcs_in_module to list go source + test files

The shell function go_srcs_in_module will list go test files
along with go src files in the specified module. This helps
in identifying the copyright header misses in test files.

Fixes #14827

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
dependabot/go_modules/go.uber.org/atomic-1.10.0
Bhargav Ravuri 2022-11-23 21:40:32 +05:30
parent 51c0b4dff3
commit cc77eb1011
1 changed files with 1 additions and 1 deletions

View File

@ -108,7 +108,7 @@ function relativePath {
# go_srcs_in_module [package]
# returns list of all not-generated go sources in the current (dir) module.
function go_srcs_in_module {
go list -f "{{with \$c:=.}}{{range \$f:=\$c.GoFiles }}{{\$c.Dir}}/{{\$f}}{{\"\n\"}}{{end}}{{end}}" ./... | grep -vE "(\\.pb\\.go|\\.pb\\.gw.go)"
go list -f "{{with \$c:=.}}{{range \$f:=\$c.GoFiles }}{{\$c.Dir}}/{{\$f}}{{\"\n\"}}{{end}}{{range \$f:=\$c.TestGoFiles }}{{\$c.Dir}}/{{\$f}}{{\"\n\"}}{{end}}{{end}}" ./... | grep -vE "(\\.pb\\.go|\\.pb\\.gw.go)"
}
# pkgs_in_module [optional:package_pattern]