From 4db0e6eccc8745ed765f3863d221ea13c57f0bd1 Mon Sep 17 00:00:00 2001 From: Viktor Stanchev Date: Tue, 26 Nov 2019 17:27:43 +0300 Subject: [PATCH] keep function private --- internal/code/imports.go | 6 +++--- internal/code/util.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/code/imports.go b/internal/code/imports.go index b9369f0369..3660079633 100644 --- a/internal/code/imports.go +++ b/internal/code/imports.go @@ -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) @@ -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 } diff --git a/internal/code/util.go b/internal/code/util.go index 56442bf3ff..cbe40858e2 100644 --- a/internal/code/util.go +++ b/internal/code/util.go @@ -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 }