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

Missing second argument for method uuid.Must() #76

Closed
beng90 opened this issue Sep 3, 2018 · 14 comments
Closed

Missing second argument for method uuid.Must() #76

beng90 opened this issue Sep 3, 2018 · 14 comments

Comments

@beng90
Copy link

beng90 commented Sep 3, 2018

vendor/gopkg.in/oauth2.v3/generates/access.go:28:65: not enough arguments in call to uuid.Must
		have (uuid.UUID)
		want (uuid.UUID, error)
vendor/gopkg.in/oauth2.v3/generates/access.go:31:67: not enough arguments in call to uuid.Must
		have (uuid.UUID)
		want (uuid.UUID, error)
vendor/gopkg.in/oauth2.v3/generates/authorize.go:24:31: not enough arguments in call to uuid.Must
		have (uuid.UUID)
		want (uuid.UUID, error)
vendor/gopkg.in/oauth2.v3/store/token.go:46:23: not enough arguments in call to uuid.Must
		have (uuid.UUID)
		want (uuid.UUID, error)

Example from generates/access.go

access = base64.URLEncoding.EncodeToString(uuid.NewV3(uuid.Must(uuid.NewV4()), buf.String()).Bytes())

Fixed code:
access = base64.URLEncoding.EncodeToString(uuid.NewV3(uuid.Must(uuid.NewV4(), err), buf.String()).Bytes())

@LyricTian
Copy link
Member

Try to update the package:go get -u -v github.com/satori/go.uuid

@beng90
Copy link
Author

beng90 commented Sep 4, 2018

It won't help.
Must() function require two parameters and satori still has the same in implementation.
https://github.com/satori/go.uuid/blob/36e9d2ebbde5e3f13ab2e25625fd453271d6522e/uuid.go#L156

I can fix it in oauth2 package but I don't know how to contribute.

@beng90
Copy link
Author

beng90 commented Sep 4, 2018

@LyricTian could you do the change in code. This is simple fix.
I can prepare Pull request if you set me as contributor.

@LyricTian
Copy link
Member

You can try to update the package:

go get -v -u github.com/satori/go.uuid
go get -v -u gopkg.in/oauth2.v3

I have found no problems with my use here.

// NewV4 returns random generated UUID.
func NewV4() (UUID, error) {
	return global.NewV4()
}
func Must(u UUID, err error) UUID {
	if err != nil {
		panic(err)
	}
	return u
}

@adamdecaf
Copy link

@LyricTian I'm trying with go modules and getting the same error.

https://github.com/go-oauth2/oauth2/blob/v3.8.12/store/token.go#L46
https://github.com/satori/go.uuid/blob/v1.2.0/uuid.go#L156

Those are the latest tags so go mod picks them both up.

@LyricTian
Copy link
Member

OK,I have removed the package:github.com/satori/go.uuid.You try again:
go get -v -u gopkg.in/oauth2.v3

@beng90
Copy link
Author

beng90 commented Sep 7, 2018

It's much better but I still see one bug
vendor/gopkg.in/go-oauth2/redis.v1/token.go:44:23: not enough arguments in call to uuid.Must have (uuid.UUID) want (uuid.UUID, error)

When function require 2 parameters we cannot pass just one even when it can be nil

@LyricTian
Copy link
Member

OK.You try again:go get -u -v gopkg.in/go-oauth2/redis.v3

@beng90
Copy link
Author

beng90 commented Sep 7, 2018

It is the other bug
not enough arguments in call to manager.MustTokenStorage have (*"vendor/gopkg.in/go-oauth2/redis.v3".TokenStore) want (oauth2.TokenStore, error)

Example usage:
manager.MustTokenStorage(redis.NewRedisStore(&redis.Options{ Addr: config.Redis.Host + ":" + strconv.Itoa(config.Redis.Port), }))

NewRedisStore returns different than NewTokenStore in redis.v1

@LyricTian
Copy link
Member

you can try MapTokenStorage

@adamdecaf
Copy link

adamdecaf commented Sep 7, 2018

@LyricTian Thanks for the fixes. Could we get a bugfix release tagged for go modules?

@LyricTian
Copy link
Member

Yes, what do I need to do?

@adamdecaf
Copy link

I bumped my project to v3.9.0 and it worked, thanks!

@ptman
Copy link

ptman commented May 13, 2019

so this is done and could be closed?

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

No branches or pull requests

4 participants