From cf1809a64b2836ed048628d65a90cb55c9c44da5 Mon Sep 17 00:00:00 2001 From: radioinmyhead Date: Tue, 21 Feb 2017 16:30:55 +0800 Subject: [PATCH] fix GOROOT set goroot by runtime.GOROOT if goroot is empty --- g_docs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/g_docs.go b/g_docs.go index fbc22b3..d6c2df2 100644 --- a/g_docs.go +++ b/g_docs.go @@ -26,6 +26,7 @@ import ( "path/filepath" "reflect" "regexp" + "runtime" "strconv" "strings" "unicode" @@ -402,6 +403,9 @@ func analyseControllerPkg(localName, pkgpath string) { func isSystemPackage(pkgpath string) bool { goroot := os.Getenv("GOROOT") + if goroot == "" { + goroot = runtime.GOROOT() + } if goroot == "" { logger.Fatalf("GOROOT environment variable is not set or empty") }