// ErrNoClue is for the situation that existing information is not enough to make a decision. For example, Router may return this error when there is no suitable route.
ErrNoClue=errors.New("not enough information for making a decision")
)
// Must panics if err is not nil.
funcMust(errerror){
iferr!=nil{
panic(err)
}
}
// Must2 panics if the second parameter is not nil, otherwise returns the first parameter.
funcMust2(vinterface{},errerror)interface{}{
Must(err)
returnv
}
// Error2 returns the err from the 2nd parameter.
funcError2(vinterface{},errerror)error{
returnerr
}
// envFile returns the name of the Go environment configuration file.
// Copy from https://github.com/golang/go/blob/c4f2a9788a7be04daf931ac54382fbe2cb754938/src/cmd/go/internal/cfg/cfg.go#L150-L166
funcenvFile()(string,error){
iffile:=os.Getenv("GOENV");file!=""{
iffile=="off"{
return"",fmt.Errorf("GOENV=off")
}
returnfile,nil
}
dir,err:=os.UserConfigDir()
iferr!=nil{
return"",err
}
ifdir==""{
return"",fmt.Errorf("missing user-config dir")
}
returnfilepath.Join(dir,"go","env"),nil
}
// GetRuntimeEnv returns the value of runtime environment variable,
// that is set by running following command: `go env -w key=value`.