-
Notifications
You must be signed in to change notification settings - Fork 419
Description
When attempting to use the Parser options, developers are confronted with a comment which gives incorrect information:
ParserOption is used to implement functional-style options that modify the behavior of the parser. To add new options, just create a function (ideally beginning with With or Without) that returns an anonymous function that takes a *Parser type as input and manipulates its configuration accordingly.
This comment is probably fine (though seemingly unnecessary) as an internal note for maintainers, but since this is part of the godoc comment, it seems to say that it is possible to create new ParserOptions
if desired. This is not the case, since Parser
is a struct with exclusively unexported members:
type Parser struct {
// If populated, only these methods will be considered valid.
validMethods []string
// Use JSON Number format in JSON decoder.
useJSONNumber bool
// Skip claims validation during token parsing.
skipClaimsValidation bool
validator *Validator
decodeStrict bool
decodePaddingAllowed bool
}
In my opinion, the blurb:
To add new options, just create a function (ideally beginning with With or Without) that returns an anonymous function that takes a *Parser type as input and manipulates its configuration accordingly.
should be removed from the godoc comment, since this is giving incorrect information to developers who check the API documentation because they want to use the library rather than open a PR against it.