fix GOROOT

set goroot by runtime.GOROOT if goroot is empty
This commit is contained in:
radioinmyhead 2017-02-21 16:30:55 +08:00 committed by GitHub
parent 14eeb07402
commit cf1809a64b
1 changed files with 4 additions and 0 deletions

View File

@ -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")
}