diff options
author | Michael Muré <batolettre@gmail.com> | 2019-04-10 01:48:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-10 01:48:53 +0200 |
commit | 9722d7c9eca28b1710e50ac9075fd11d0db0606a (patch) | |
tree | e46d372dcd1e68fb067101778eb0a5f13f745ad0 /vendor/github.com/99designs/gqlgen/internal/gopath/gopath.go | |
parent | 30efc99f4493f3a09e94bf322cbf8ef844beea13 (diff) | |
parent | 4d14cadde45ac807afcbfd37200e86c4de6bf8db (diff) | |
download | git-bug-9722d7c9eca28b1710e50ac9075fd11d0db0606a.tar.gz |
Merge pull request #123 from A-Hilaly/graphql
Upgrade gqlgen version to 0.8.3
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/internal/gopath/gopath.go')
-rw-r--r-- | vendor/github.com/99designs/gqlgen/internal/gopath/gopath.go | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/vendor/github.com/99designs/gqlgen/internal/gopath/gopath.go b/vendor/github.com/99designs/gqlgen/internal/gopath/gopath.go deleted file mode 100644 index c9b66167..00000000 --- a/vendor/github.com/99designs/gqlgen/internal/gopath/gopath.go +++ /dev/null @@ -1,37 +0,0 @@ -package gopath - -import ( - "fmt" - "go/build" - "path/filepath" - "strings" -) - -var NotFound = fmt.Errorf("not on GOPATH") - -// Contains returns true if the given directory is in the GOPATH -func Contains(dir string) bool { - _, err := Dir2Import(dir) - return err == nil -} - -// Dir2Import takes an *absolute* path and returns a golang import path for the package, and returns an error if it isn't on the gopath -func Dir2Import(dir string) (string, error) { - dir = filepath.ToSlash(dir) - for _, gopath := range filepath.SplitList(build.Default.GOPATH) { - gopath = filepath.ToSlash(filepath.Join(gopath, "src")) - if len(gopath) < len(dir) && strings.EqualFold(gopath, dir[0:len(gopath)]) { - return dir[len(gopath)+1:], nil - } - } - return "", NotFound -} - -// MustDir2Import takes an *absolute* path and returns a golang import path for the package, and panics if it isn't on the gopath -func MustDir2Import(dir string) string { - pkg, err := Dir2Import(dir) - if err != nil { - panic(err) - } - return pkg -} |