-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fx-annotate] Verify invalid tags passed to fx.Annotate #835
Some tags passed with fx.Annotate follow the struct format ``` fx.Annotate(f, fx.ParamTags(`group:”myGroup”)) ``` Where the tag is of the format `<tag_name>:”tag_value”` and the tag values must be contained within double quotes. If a user accidentally passes an invalid tag with mismatched quotes, the issue is not identified and no error is thrown. This is not desired as the tag gets passed to dig, where it’s ignored as it’s not a valid group tag. This commit adds checks to identify if invalid tags are passed to fx.Annotate. If identified then it throws an error with the right tag format specified. For e.g. - ``` fx.Annotate(f, fx.ParamTags(`group:'myGroup"`)) ``` Should be an invalid tag as it starts from a single quote and ends with a double quote (mismatched quotes instead of “..”) We added checks for ParamTag and ResultTag to verify and capture this invalid tag. Now, when we pass this invalid tag we get the following error : ``` Encountered error while applying annotation using fx.Annotate to function, tag value should start with double quote ``` Refs : #835
- Loading branch information
Showing
3 changed files
with
212 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters