Skip to content

Commit

Permalink
keep function private
Browse files Browse the repository at this point in the history
  • Loading branch information
vikstrous committed Nov 26, 2019
1 parent b829628 commit 4db0e6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/code/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func NameForDir(dir string) string {
return SanitizePackageName(filepath.Base(dir))
}

// GoModuleRoot returns the root of the current go module if there is a go.mod file in the directory tree
// goModuleRoot returns the root of the current go module if there is a go.mod file in the directory tree
// If not, it returns false
func GoModuleRoot(dir string) (string, bool) {
func goModuleRoot(dir string) (string, bool) {
dir, err := filepath.Abs(dir)
if err != nil {
panic(err)
Expand Down Expand Up @@ -91,7 +91,7 @@ func ImportPathForDir(dir string) (res string) {
}
dir = filepath.ToSlash(dir)

modDir, ok := GoModuleRoot(dir)
modDir, ok := goModuleRoot(dir)
if ok {
return modDir
}
Expand Down
2 changes: 1 addition & 1 deletion internal/code/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func QualifyPackagePath(importPath string) string {
wd, _ := os.Getwd()

// in go module mode, the import path doesn't need fixing
if _, ok := GoModuleRoot(wd); ok {
if _, ok := goModuleRoot(wd); ok {
return importPath
}

Expand Down

0 comments on commit 4db0e6e

Please sign in to comment.