gomodifytags
go
gomodifytags | go | |
---|---|---|
3 | 2,184 | |
2,285 | 124,539 | |
- | 0.6% | |
1.9 | 10.0 | |
2 months ago | 3 days ago | |
Go | Go | |
BSD 3-clause "New" or "Revised" License | BSD 3-clause "New" or "Revised" 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
go
- Go proposal: finite type set interface as union type
-
Good union types in Go would probably need types without a zero value
// handle unexported go stdlib error, XXX fix after https://github.com/golang/go/issues/35234
-
Weak pointers in Go: why they matter now
Go without concurrency is fully memory safe. However, once you start using goroutines there can be memory corruption and segfaults: https://github.com/golang/go/issues/37484. Note that these are not recoverable panics (such as "writing to a close channel"), but causes completely arbitrary behavior:
runtime: pointer 0xc00379ac60 to unused region of span span.base()=0xc001794000 span.limit=0xc001795e00 span.state=1
-
Union types ('enum types') would be complicated in Go
As for first entry, this has been discussed many times without ever reaching any consensus, see - https://github.com/golang/go/issues/19412
- Glojure: Clojure interpreter hosted on Go, with extensible interop support
- How Much Memory Do You Need in 2024 to Run 1M Concurrent Tasks?
-
Hyrum's Law in Golang
To be fair to those projects, the type was introduced only three years ago:
https://github.com/golang/go/pull/49359/files
Before that, doing a string compare was basically the only way to detect that specific error. That was definitely an omission on the part of the original authors of the stdlib code; I don't it should be classified as "Hyrum's Law".
-
Build Golang from Source for v1.23+
git clone https://github.com/golang/go OR git clone https://go.googlesource.com/go
-
Personal TODO list on how I set up my dev machine
I install go.
-
Constraints in Go
The difference between types.Implements and types.Satisfies is mainly a history reason, a tradeoff between keeping backward compatibility and theory perfection.
It is pity that Go didn't support the "comparable" interface from the beginning. If it has been supported since Go 1.0, then this tradeoff can be avoided.
There are more limitations in current Go custom generics, much of them could be removed when this proposal (https://github.com/golang/go/issues/70128) is done.
I recommend people to read Go Generics 101 (https://go101.org/generics/101.html, author here) for a thoroughly understanding the status quo of Go custom generics.
What are some alternatives?
dynamic-struct - Golang package for editing struct's fields during runtime and mapping structs to other structs.
v - Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
gopium - Gopium 🌺: Smart Go Structures Optimizer and Manager
TinyGo - Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
go-wiki - This is a Golang open-source module that makes it easy to access and parse data from Wikipedia (Wikipedia API wrapper)
zig - General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
autogold - Automatically update your Go tests
Nim - Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
backoff - ⏱ The exponential backoff algorithm in Go
Angular - Deliver web apps with confidence 🚀
pretty - Pretty printing for Go values
golang-developer-roadmap - Roadmap to becoming a Go developer in 2020