Skip to content

Commit

Permalink
Merge pull request #16 from gabeguz/master
Browse files Browse the repository at this point in the history
Don't exit if $GOPATH/src is a symlink
  • Loading branch information
kujtimiihoxha authored Apr 1, 2019
2 parents 37c59ca + 95f98a6 commit 543fc76
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"os"
"path"
"path/filepath"
"runtime"
"strings"

Expand All @@ -22,6 +23,16 @@ func main() {
logrus.Error(err)
return
}
gosrc, err = filepath.EvalSymlinks(gosrc)
if err != nil {
logrus.Error(err)
return
}
pwd, err = filepath.EvalSymlinks(pwd)
if err != nil {
logrus.Error(err)
return
}
if !strings.HasPrefix(pwd, gosrc) {
logrus.Error("The project must be in the $GOPATH/src folder for the generator to work.")
return
Expand Down

0 comments on commit 543fc76

Please sign in to comment.