From ff809b73c37b82f7e1a726e9c6fb5f3c07dee0a1 Mon Sep 17 00:00:00 2001 From: verytable Date: Sun, 2 Feb 2020 01:14:20 +0300 Subject: [PATCH] Start doc comments with the name being declared. --- tools/testtool/commands/list.go | 14 +++++++------- tools/testtool/commands/test_submission.go | 10 +++++----- tools/testtool/commands/test_submission_test.go | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/testtool/commands/list.go b/tools/testtool/commands/list.go index 1578fd3..aaafb02 100644 --- a/tools/testtool/commands/list.go +++ b/tools/testtool/commands/list.go @@ -5,9 +5,8 @@ import ( "strings" ) -// List all _test.go files in given directory including the ones with "private" build tag. -// -// Returns absolute paths. +// listTestFiles returns absolute paths for all _test.go files of the package +// including the ones with "private" build tag. func listTestFiles(rootPackage string) []string { files := getPackageFiles(rootPackage, []string{"-tags", "private"}) var tests []string @@ -21,9 +20,8 @@ func listTestFiles(rootPackage string) []string { return tests } -// List all .go source files in given directory protected by "!change" build tag. -// -// Returns absolute paths. +// listProtectedFiles returns absolute paths for all files of the package +// protected by "!change" build tag. func listProtectedFiles(rootPackage string) []string { allFiles := getPackageFiles(rootPackage, nil) allFilesWithoutProtected := getPackageFiles(rootPackage, []string{"-tags", "change"}) @@ -39,6 +37,8 @@ func listProtectedFiles(rootPackage string) []string { return protectedFiles } +// listPrivateFiles returns absolute paths for all files of the package +// protected by "private,solution" build tag. func listPrivateFiles(rootPackage string) []string { allFiles := getPackageFiles(rootPackage, []string{}) allWithPrivate := getPackageFiles(rootPackage, []string{"-tags", "private,solution"}) @@ -52,4 +52,4 @@ func listPrivateFiles(rootPackage string) []string { sort.Strings(files) return files -} \ No newline at end of file +} diff --git a/tools/testtool/commands/test_submission.go b/tools/testtool/commands/test_submission.go index 54c6d7a..8154d6f 100644 --- a/tools/testtool/commands/test_submission.go +++ b/tools/testtool/commands/test_submission.go @@ -140,12 +140,12 @@ func copyDir(src, dst string) { } } -// copyDir recursively copies src contents to dst. +// copyContents recursively copies src contents to dst. func copyContents(src, dst string) { copyDir(src+"/", dst) } -// Copy files preserving directory structure relative to baseDir. +// copyFiles copies files preserving directory structure relative to baseDir. // // Existing files get replaced. func copyFiles(baseDir string, relPaths []string, dst string) { @@ -165,7 +165,7 @@ func copyFiles(baseDir string, relPaths []string, dst string) { } } -// Run all test in directory with race detector. +// runTests runs all tests in directory with race detector. func runTests(testDir string) { cmd := exec.Command("go", "test", "-v", "-mod", "readonly", "-tags", "private", "-race", "./...") cmd.Env = append(os.Environ(), "GOFLAGS=") @@ -182,7 +182,7 @@ func runTests(testDir string) { } } -// Get absolute paths for all files in rootPackage and it's subpackages +// getPackageFiles returns absolute paths for all files in rootPackage and it's subpackages // including tests and non-go files. func getPackageFiles(rootPackage string, buildFlags []string) map[string]struct{} { cfg := &packages.Config{ @@ -213,7 +213,7 @@ func getPackageFiles(rootPackage string, buildFlags []string) map[string]struct{ return files } -// Convert paths to relative (to the baseDir) ones. +// relPaths converts paths to relative (to the baseDir) ones. func relPaths(baseDir string, paths []string) []string { ret := make([]string, len(paths)) for i, p := range paths { diff --git a/tools/testtool/commands/test_submission_test.go b/tools/testtool/commands/test_submission_test.go index 83be880..deae525 100644 --- a/tools/testtool/commands/test_submission_test.go +++ b/tools/testtool/commands/test_submission_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" ) -// List directories in given directory. +// listDirs lists directories in given directory. func listDirs(dir string) ([]string, error) { files, err := ioutil.ReadDir(dir) if err != nil {