From 63976d5fd90bf374c9b0553ac34c3e68bec88310 Mon Sep 17 00:00:00 2001 From: tianhai82 Date: Sun, 17 Jun 2018 23:17:29 +0800 Subject: [PATCH] fix GOPATH case mismatch issue --- codegen/codegen.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/codegen/codegen.go b/codegen/codegen.go index 9a847d24c59..0fd36ef5dc6 100644 --- a/codegen/codegen.go +++ b/codegen/codegen.go @@ -149,7 +149,9 @@ func fullPackageName(dir string, pkgName string) string { for _, gopath := range filepath.SplitList(build.Default.GOPATH) { gopath = filepath.Join(gopath, "src") + string(os.PathSeparator) - fullPkgName = strings.TrimPrefix(fullPkgName, gopath) + if strings.EqualFold(gopath, fullPkgName[0:len(gopath)]) { + fullPkgName = fullPkgName[len(gopath):] + } } return filepath.ToSlash(fullPkgName) }