Skip to content

Commit

Permalink
Don't exit if $GOPATH/src is a symlink
Browse files Browse the repository at this point in the history
EvalSymlinks() before comparing the `pwd` with $GOPATH/src so that in
the case where $GOPATH/src is a symbolic link (to a case sensitive
filesystem on a mac for instance) the `kit` command will still execute
successfully.
  • Loading branch information
Gabriel Guzman authored and Gabriel Guzman committed Oct 11, 2018
1 parent 69ae4c3 commit 95f98a6
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 95f98a6

Please sign in to comment.