aboutsummaryrefslogtreecommitdiff
path: root/pkg/rtree/repo.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2017-05-09 20:13:59 +0200
committerStefan Majewsky <majewsky@gmx.net>2017-05-09 20:13:59 +0200
commit0e56e63c833229ca02f2c62d4ee50cf371b6ac9a (patch)
tree0d69271229ca15b98e55d75b3b8936675aa25fcd /pkg/rtree/repo.go
parent2f93c6ca308a15c5d3e280274bd698604276143c (diff)
downloadgofu-0e56e63c833229ca02f2c62d4ee50cf371b6ac9a.tar.gz
replace panic() by a collector for early errors
Diffstat (limited to 'pkg/rtree/repo.go')
-rw-r--r--pkg/rtree/repo.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/rtree/repo.go b/pkg/rtree/repo.go
index fba658b..99df30d 100644
--- a/pkg/rtree/repo.go
+++ b/pkg/rtree/repo.go
@@ -19,7 +19,6 @@
package rtree
import (
- "errors"
"fmt"
"os"
"path/filepath"
@@ -27,6 +26,7 @@ import (
"strings"
"github.com/majewsky/gofu/pkg/cli"
+ "github.com/majewsky/gofu/pkg/earlyerrors"
)
//RootPath is the directory below which all repositories are located. Its value
@@ -36,9 +36,10 @@ var RootPath string
func init() {
gopath := os.Getenv("GOPATH")
if gopath == "" {
- panic(errors.New("$GOPATH is not set (rtree needs the GOPATH variable to know where to look for and place repos)"))
+ earlyerrors.Put("$GOPATH is not set (rtree needs the GOPATH variable to know where to look for and place repos)")
+ } else {
+ RootPath = filepath.Join(gopath, "src")
}
- RootPath = filepath.Join(gopath, "src")
}
//Repo describes the entry for a repository in the index file.