GitShow/fatih/structtag
fatih

structtag

Parse and modify Go struct field tags

by fatih
gostructstags
Star on GitHubFork

Go

652 stars47 forks4 contributorsQuiet · 2y agoSince 2017v1.2.0

Meet the team

See all 4 on GitHub →
fatih
fatih16 contributions
vanodevium
vanodevium2 contributions

Languages

View on GitHub →
Go100%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

2 of 6 standards met

Community profile →
42
✓README✓License○Contributing○Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Quiet · 4 in progress · Last activity 2y ago
See all on GitHub →
c-tonneslan
export sentinel errors so callers can use errors.IsOpenPR

Closes #24. Per @fatih's note on the issue, the sentinel errors were unexported, so callers were stuck doing string-compare on the message to handle a 'tag not found' specifically. Promote them to \ and keep the lowercase names as aliases so the internal call sites compile unchanged. Lets users write: \\\

c-tonneslan · 1mo ago
c-tonneslan
docs: rewrite Tags.Get doc commentOpenPR

For #26. The current Get comment talks about an \ return value that doesn't exist (the function returns \) and mentions returning an 'empty string' which doesn't match how Tag is structured. Updated to actually describe the signature and the only error returned. This is intentionally separate from the export-sentinels PR (#27) so each can land on its own. Once #27 lands the doc can be tightened further to mention \.

c-tonneslan · 1mo ago
nielskrijger
Unclear Get(...) API and documentationOpenIssue

Hi there! I tried using the library but got a little confused. Particularly the current documentation and API of was a matter of trial & error. The comment suggests a pattern like: In reality, is an error, not a boolean, so it wouldn't work. The main README adds to the confusion: Based on that panic I wouldn't expect the only error returned by is (which perfectly OK in my scenario). The panic example in the docs signals something more severe is going on. Moreover, because is not exported, callers can’t do something like A more sensible signature would be: so that the caller can check existence with a boolean rather than treating “not found” as an error. Similar to Go's type checking. Unfortunately, changing from to would break backwards compatibility. As an alternative, the library could introduce something like: that returns a boolean found flag instead of an error. This would leave Get unchanged (preserving compatibility) while providing a clearer, more “Go-idiomatic” lookup method. There's various possibilities here, not sure which is the best one. I figured I'd just share my first experience with this lib :-)

nielskrijger · 1y ago

Recent fixes

View closed PRs →
romshark
Export error sentinel values and refactorMergedPR

chore: Upgrade gomod to Go 1.21. perf: Preallocate slice in . test: Add more tests and improve test coverage. test: Move syntax error testing to . refactor: Use github.com/stretchr/testify to simplify tests. refactor: Use black-box testing (test package with "_test" suffix). refactor: Use generic slice search function to reduce code duplication. A little more than promised, but I hope you're fine with these changes living in 1 PR (saved me time). Please let me know if you want these changes to be split across multiple PRs. resolves #24

romshark · 1y ago
liorokman
Split the options taking into consideration escaped commasMergedPR

Fixes #21

liorokman · 3y ago
Structured data for AI agents

Repository: fatih/structtag. Description: Parse and modify Go struct field tags Stars: 652, Forks: 47. Primary language: Go. Languages: Go (100%). Topics: go, structs, tags. Latest release: v1.2.0 (6y ago). Open PRs: 4, open issues: 3. Last activity: 2y ago. Community health: 42%. Top contributors: fatih, vanodevium.

·@ofershap

Replace github.com with gitshow.dev