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

Wrong pop package import in goth-auth template #8

Closed
piffio opened this issue Mar 11, 2018 · 2 comments · Fixed by #9
Closed

Wrong pop package import in goth-auth template #8

piffio opened this issue Mar 11, 2018 · 2 comments · Fixed by #9

Comments

@piffio
Copy link
Contributor

piffio commented Mar 11, 2018

When trying to setup a new project with buffalo and github authentication I stumbled upon the following issue.

First of all, these are the steps I followed:

I set up a simple project as follows

$ buffalo new goth-auth
[...]
$ cd goth_auth/
$ buffalo db create --all

Then I tried to add github authentication using the goth-auth capability:

$ buffalo generate goth-auth github
INFO[0000] Find is deprecated, and will be removed in v0.12.0. Use generators.FindByBox instead. Called from /home/piffio/src/github.com/gobuffalo/buffalo-goth/auth/auth.go:14
      create  actions/auth.go
      create  actions/auth_test.go
         run  buffalo db generate model user name email:nulls.String provider provider_id
v4.1.0

      create  models/user.go
      create  models/user_test.go
         run  goimports -w actions/actions_test.go actions/app.go actions/auth.go actions/auth_test.go actions/home.go actions/home_test.go actions/render.go grifts/db.go grifts/init.go main.go models/models.go models/models_test.go models/user.go models/user_test.go
> migrations/20180311214330_create_users.up.fizz
> migrations/20180311214330_create_users.down.fizz
         run  go get github.com/markbates/goth/...
]$ buffalo dev
buffalo: 2018/03/11 22:44:02 === Rebuild on: :start: ===
buffalo: 2018/03/11 22:44:02 === Running: go build -v -i -o tmp/goth-auth-build  (PID: 8650) ===
github.com/piffio/goth_auth/actions
# github.com/piffio/goth_auth/actions
actions/auth.go:46:10: cannot use "github.com/markbates/pop/nulls".NewString(gu.Email) (type "github.com/markbates/pop/nulls".String) as type "github.com/gobuffalo/pop/nulls".String in assignment
buffalo: 2018/03/11 22:44:02 === Error! ===
buffalo: 2018/03/11 22:44:02 === exit status 2
github.com/piffio/goth_auth/actions
# github.com/piffio/goth_auth/actions
actions/auth.go:46:10: cannot use "github.com/markbates/pop/nulls".NewString(gu.Email) (type "github.com/markbates/pop/nulls".String) as type "github.com/gobuffalo/pop/nulls".String in assignment

This is caused by the fact that buffalo and buffalo-goth are using different signatures for the pop package, as follows:

$  grep -r "markbates\/pop" *
actions/auth.go:        "github.com/markbates/pop"
actions/auth.go:        "github.com/markbates/pop/nulls"
actions/auth_test.go:   "github.com/markbates/pop/nulls"
$  grep -r "gobuffalo\/pop" *
models/models.go:       "github.com/gobuffalo/pop"
models/user.go: "github.com/gobuffalo/pop"
models/user.go: "github.com/gobuffalo/pop/nulls"

The issue seems to be in the file auth/templates/actions/auth.go.tmpl.

I will be attaching a pull request after testing the fix

@piffio
Copy link
Contributor Author

piffio commented Mar 11, 2018

Searching in buffalo commit history, it seems like the issue appeared as a consequence of this recent commit: gobuffalo/buffalo#933

@markbates
Copy link
Member

Thanks! It’s very much appreciated.

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.

2 participants