Start doc comments with the name being declared.
This commit is contained in:
parent
7d8f8fcb31
commit
ff809b73c3
3 changed files with 13 additions and 13 deletions
|
@ -5,9 +5,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// List all _test.go files in given directory including the ones with "private" build tag.
|
// listTestFiles returns absolute paths for all _test.go files of the package
|
||||||
//
|
// including the ones with "private" build tag.
|
||||||
// Returns absolute paths.
|
|
||||||
func listTestFiles(rootPackage string) []string {
|
func listTestFiles(rootPackage string) []string {
|
||||||
files := getPackageFiles(rootPackage, []string{"-tags", "private"})
|
files := getPackageFiles(rootPackage, []string{"-tags", "private"})
|
||||||
var tests []string
|
var tests []string
|
||||||
|
@ -21,9 +20,8 @@ func listTestFiles(rootPackage string) []string {
|
||||||
return tests
|
return tests
|
||||||
}
|
}
|
||||||
|
|
||||||
// List all .go source files in given directory protected by "!change" build tag.
|
// listProtectedFiles returns absolute paths for all files of the package
|
||||||
//
|
// protected by "!change" build tag.
|
||||||
// Returns absolute paths.
|
|
||||||
func listProtectedFiles(rootPackage string) []string {
|
func listProtectedFiles(rootPackage string) []string {
|
||||||
allFiles := getPackageFiles(rootPackage, nil)
|
allFiles := getPackageFiles(rootPackage, nil)
|
||||||
allFilesWithoutProtected := getPackageFiles(rootPackage, []string{"-tags", "change"})
|
allFilesWithoutProtected := getPackageFiles(rootPackage, []string{"-tags", "change"})
|
||||||
|
@ -39,6 +37,8 @@ func listProtectedFiles(rootPackage string) []string {
|
||||||
return protectedFiles
|
return protectedFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// listPrivateFiles returns absolute paths for all files of the package
|
||||||
|
// protected by "private,solution" build tag.
|
||||||
func listPrivateFiles(rootPackage string) []string {
|
func listPrivateFiles(rootPackage string) []string {
|
||||||
allFiles := getPackageFiles(rootPackage, []string{})
|
allFiles := getPackageFiles(rootPackage, []string{})
|
||||||
allWithPrivate := getPackageFiles(rootPackage, []string{"-tags", "private,solution"})
|
allWithPrivate := getPackageFiles(rootPackage, []string{"-tags", "private,solution"})
|
||||||
|
@ -52,4 +52,4 @@ func listPrivateFiles(rootPackage string) []string {
|
||||||
|
|
||||||
sort.Strings(files)
|
sort.Strings(files)
|
||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
func copyContents(src, dst string) {
|
||||||
copyDir(src+"/", dst)
|
copyDir(src+"/", dst)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy files preserving directory structure relative to baseDir.
|
// copyFiles copies files preserving directory structure relative to baseDir.
|
||||||
//
|
//
|
||||||
// Existing files get replaced.
|
// Existing files get replaced.
|
||||||
func copyFiles(baseDir string, relPaths []string, dst string) {
|
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) {
|
func runTests(testDir string) {
|
||||||
cmd := exec.Command("go", "test", "-v", "-mod", "readonly", "-tags", "private", "-race", "./...")
|
cmd := exec.Command("go", "test", "-v", "-mod", "readonly", "-tags", "private", "-race", "./...")
|
||||||
cmd.Env = append(os.Environ(), "GOFLAGS=")
|
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.
|
// including tests and non-go files.
|
||||||
func getPackageFiles(rootPackage string, buildFlags []string) map[string]struct{} {
|
func getPackageFiles(rootPackage string, buildFlags []string) map[string]struct{} {
|
||||||
cfg := &packages.Config{
|
cfg := &packages.Config{
|
||||||
|
@ -213,7 +213,7 @@ func getPackageFiles(rootPackage string, buildFlags []string) map[string]struct{
|
||||||
return files
|
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 {
|
func relPaths(baseDir string, paths []string) []string {
|
||||||
ret := make([]string, len(paths))
|
ret := make([]string, len(paths))
|
||||||
for i, p := range paths {
|
for i, p := range paths {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
// List directories in given directory.
|
// listDirs lists directories in given directory.
|
||||||
func listDirs(dir string) ([]string, error) {
|
func listDirs(dir string) ([]string, error) {
|
||||||
files, err := ioutil.ReadDir(dir)
|
files, err := ioutil.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue