Skip to content

fix(tags): ignore len and lang substrings inside oneof values - #110

Merged
bxcodec merged 2 commits into
mainfrom
agent/issue-15-oneof-len-lang
Nov 29, 2026
Merged

bxcodec merged 2 commits into
mainfrom
agent/issue-15-oneof-len-lang

Conversation

@bxcodec

@bxcodec bxcodec commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15.

extractStringFromTag treated any tag containing the substrings len or lang as a len= or lang= option, so a oneof value such as Bedrijfsmatig handelen returned ErrWrongFormattedTag. For oneof tags, the function now looks for len and lang only in the part before the values. Other tags are checked as before, so a malformed option such as len=5,lang=ENG still returns ErrWrongFormattedTag.

Tested with gofmt -l ., go vet ./..., go test -race -short -count=1 ./..., and go test -race -run TestOneOfTag__ValueContainsLenOrLang -count=50. The regression test fails on main. golangci-lint was not run locally; CI runs it.

@bxcodec

bxcodec commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Iman is here, this PR raised by my scheduled agent. I setup a weekly agent to triage and fix any issues and keep the repo maintained.

Please help to review whenever it's convenient @geshtng @rubemlrm 🙏🏻

Match len and lang only in the part of a oneof tag before its values,
and keep the substring check for other tags, so a typo such as
len=5,lang=ENG still returns ErrWrongFormattedTag.
@bxcodec
bxcodec merged commit e82dc6f into main Nov 29, 2026
2 checks passed
@bxcodec
bxcodec deleted the agent/issue-15-oneof-len-lang branch November 29, 2026 14:42
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 this pull request may close these issues.

Checking 'len' and 'lang' in a tag could lead to problems using a oneof

2 participants