check the gopath before start

This commit is contained in:
alessio 2016-08-21 16:35:17 +02:00
parent 09873ae083
commit 9ef0d84ab6
1 changed files with 15 additions and 9 deletions

12
main.go
View File

@ -1,10 +1,11 @@
package main package main
import ( import (
"fmt"
r "github.com/tockins/realize/realize" r "github.com/tockins/realize/realize"
"gopkg.in/urfave/cli.v2" "gopkg.in/urfave/cli.v2"
"log"
"os" "os"
"fmt"
"strings" "strings"
) )
@ -20,8 +21,13 @@ func main() {
return nil return nil
} }
header := func() { header := func() error {
app.Information() app.Information()
gopath := os.Getenv("GOPATH")
if gopath == "" {
log.Fatal(r.Red("$GOPATH isn't set up properly"))
}
return nil
} }
wd := func() string { wd := func() string {
@ -38,7 +44,7 @@ func main() {
Name: app.Name, Name: app.Name,
Version: app.Version, Version: app.Version,
Authors: []*cli.Author{ Authors: []*cli.Author{
&cli.Author{ {
Name: app.Author, Name: app.Author,
Email: app.Email, Email: app.Email,
}, },