gomodifytags
versioninfo
Our great sponsors
gomodifytags | versioninfo | |
---|---|---|
3 | 6 | |
2,186 | 231 | |
- | - | |
4.1 | 3.7 | |
5 months ago | 9 months ago | |
Go | Go | |
BSD 3-clause "New" or "Revised" License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
gomodifytags
-
Which Tools Do You use daily for Golang development?
gomodifytags
-
Libraries you use most of your projects?
https://github.com/fatih/gomodifytags - generate or modify struct tags
-
Improving the code from the official Go RESTful API tutorial
I suspect it's because Go's general philosophy is that it's better to be verbose and explicit (than terse and magical). Probably falls under "clear is better than clever" from Rob Pike's Go Proverbs: http://go-proverbs.github.io/
I think if this feature was added, it would not be with struct tags, but with an Encoder.SetFieldTransform(json.SnakeCase) or similar setting.
That might be quite a nice feature, actually. You could provide your own function to transform names when marshaling, and for unmarshaling it would strip punctuation and match case insensitively (because it's hard to do the reverse transform, for example should user_id go to UserId or UserID, and if the latter, how does the transform know?).
In any case, it seems like an issue was opened proposing something like that a couple of years ago (https://github.com/golang/go/issues/23027), and Russ Cox responded that the JSON package is basically done, but you could either fork it and add the feature, or use a tool that modifies struct tags like https://github.com/fatih/gomodifytags
versioninfo
-
Libraries you use most of your projects?
Oh, also https://github.com/carlmjohnson/versioninfo . Always need that.
-
FreePad | A free self-hosted pad written in go
Don’t. It’s obsolete. Just use debug.ReadBuildInfo()
-
Makefile and Dockerfile best practices
That’s obsolete. See https://github.com/carlmjohnson/versioninfo. Even if it weren’t, Make is an inappropriate tool. Because it is based on file modtimes, it can’t react to git hash changes. You just have rerun the steps every time, at which point Bash is a less awful language.
-
How to embed version when `go install`-ing (since you cannot use go:generate or ldflags -X)
Go 1.18 updates the debug info to also include the git status of the build. See https://github.com/carlmjohnson/versioninfo
-
Go 1.18 - debug/info - why not include the current git tag?
I use this trick in my versioninfo package. Obviously, it can't give you other tags, but most of the time the tag you want to know about is v1.2.3 anyway, and since tags are mutable but the Go sum DB is immutable, this is safer than just saying what tag was on disk at build time.
-
Getting excited for Go 1.18's lesser known features
I subscribed to GH activity for the correspondence friendliness-enhancing library by the author:
https://github.com/carlmjohnson/versioninfo/
The primary motivation curiousity to learn if this becomes "the [best/default] way" folks reach for when leveraging BuildInfo to deliver explicit binary versioning.
What are some alternatives?
dynamic-struct - Golang package for editing struct's fields during runtime and mapping structs to other structs.
assert - A simple assertion library using Go generics
gopium - Gopium 🌺: Smart Go Structures Optimizer and Manager
FreePad - FreePad is a simple Go project to help you juggle temporary notes that you might wanna pass from one device to another, or from a person to another with memorable and easy to communicate online "Pads".
autogold - Automatically update your Go tests
flagx - Extensions to the Go flag package
go-wiki - This is a Golang open-source module that makes it easy to access and parse data from Wikipedia (Wikipedia API wrapper)
go - The Go programming language
teller - Cloud native secrets management for developers - never leave your command line for secrets.
kong - Kong is a command-line parser for Go
backoff - ⏱ The exponential backoff algorithm in Go
json5 - JSON5 implemented by golang