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

[feature request] let configuration methods return a pointer to the instance #93

Closed
turtleDev opened this issue Nov 20, 2017 · 2 comments
Labels

Comments

@turtleDev
Copy link

turtleDev commented Nov 20, 2017

package something

import (
    "github.com/gorilla/schema"
)

var decoder = schema.NewDecoder().IgnoreUnknownKeys(true) // valid syntax

The syntax above is valid go, and is how the docs suggest you use gorilla (keeping a global instance)

however, doing this won't be valid

package something

import (
    "github.com/gorilla/schema"
)

var decoder = schema.NewDecoder()
decoder.IgnoreUnknownKeys(true)  // syntax-error: non-declaration statement outside function body

Sounds like a simple enough change. I'd be happy to send a PR.
What do you guys think?

@elithrar
Copy link
Contributor

elithrar commented Nov 20, 2017 via email

turtleDev added a commit to turtleDev/schema that referenced this issue Nov 28, 2017
This patch updates configuration methods on Encoder and Decoder.
In specific, the configuration methods now return a pointer to
the instance on which those methods were called. This facilities
method chaning in the instance declaration.
@stale
Copy link

stale bot commented Dec 9, 2018

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

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

No branches or pull requests

2 participants