Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
vektah committed Jul 26, 2020
1 parent 2f14867 commit 911321b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/code/imports.go
Expand Up @@ -80,6 +80,7 @@ func goModuleRoot(dir string) (string, bool) {
// ImportPathForDir takes a path and returns a golang import path for the package
func ImportPathForDir(dir string) (res string) {
dir, err := filepath.Abs(dir)

if err != nil {
panic(err)
}
Expand All @@ -99,4 +100,4 @@ func ImportPathForDir(dir string) (res string) {
return ""
}

var modregex = regexp.MustCompile("module (.*)\n")
var modregex = regexp.MustCompile(`module ([^\s]*)`)
1 change: 1 addition & 0 deletions internal/code/imports_test.go
Expand Up @@ -12,6 +12,7 @@ import (

func TestImportPathForDir(t *testing.T) {
wd, err := os.Getwd()

require.NoError(t, err)

assert.Equal(t, "github.com/99designs/gqlgen/internal/code", ImportPathForDir(wd))
Expand Down

0 comments on commit 911321b

Please sign in to comment.