Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build fails in go module #29

Closed
rrrkren opened this issue Oct 23, 2018 · 1 comment · Fixed by #30
Closed

build fails in go module #29

rrrkren opened this issue Oct 23, 2018 · 1 comment · Fixed by #30

Comments

@rrrkren
Copy link
Contributor

rrrkren commented Oct 23, 2018

Steps to reproduce:

mkdir testgrift && cd "$_"  #(outside of $GOPATH)
git init
git remote add origin [email protected]:rrrkren/testgrift.git
go mod init
grift init
grift hello

gives error:

build github.com/rrrkren/testgrift/.grifter: cannot find module for path testgrift/grifts
exit status 1

when I do this process without the git part everything work fine

@rrrkren
Copy link
Contributor Author

rrrkren commented Oct 23, 2018

The problem lies on https://github.com/markbates/grift/blob/master/cmd/grifter.go#L72,

g.GriftsPackagePath = filepath.ToSlash(filepath.Join(path.Base(currentPath), "grifts"))

assumes that the go module name is the same as the package name and the current directory name. In my case the module name was "github.com/rrrkren/testgrift". I'm fairly new to go but since this was generated by go mod I assume it's valid.
hardcoding g.GriftsPackagePath to "github.com/rrrkren/testgrift/grifts" makes it run, obviously not a fix but more of a hack which works for us now.
I'm going to hack something up for my use case, probably reading it off the go.mod file. Let me know if you are interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant