dst
Decorated Syntax Tree - manipulate Go source with perfect fidelity. (by dave)
betteralign
Make your Go programs use less memory (maybe) (by dkorunic)
dst | betteralign | |
---|---|---|
2 | 3 | |
1,218 | 476 | |
- | - | |
0.0 | 6.2 | |
7 months ago | 13 days ago | |
Go | Go | |
GNU General Public License v3.0 or later | BSD 3-clause "New" or "Revised" License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
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.
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.
dst
Posts with mentions or reviews of dst.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-03-22.
-
betteralign - structs field alignment static analyzer for Go
Retaining comments has been done with using DST (Decorated Syntax Tree) with decorating regular AST. Sadly when using DST we cannot use "fix" mode with SuggestedFixes, but we have to print whole DST to retain decorations. Leading/ending comment positioning isn't well retained in some cases and it's still a work in progress.
-
Rewriting Go source code with AST tooling
Go AST was never really designed for re-writing of the source. Comments are stored by their byte offset instead of attached to nodes, so re-arranging nodes breaks the output...
Check out my dst (decorated syntax tree) library: it allows you to manipulate Go source without breaking the comments and line-feeds:
https://github.com/dave/dst
betteralign
Posts with mentions or reviews of betteralign.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-03-25.
-
GitHub - orijtech/structslop: structslop is a static analyzer for Go that recommends struct field rearrangements to provide for maximum space/allocation efficiency.
I believe I have mentioned structslop just the other day when I have mentioned betteralign. Both fieldalignment (and original maligned) and structslop are great, but there are some smallish details that could be improved upon such as atomic I/O when rewriting source files, ability to skip test and/or generated files or even skip specific specific structs; and automatic GOMAXPROCS and GOMEMLIMIT tuneup when running under containers (such as in some CI pipeline). In any case, if you find this tool something that works for you, I would also appreciate if you could take a look at betteralign.
-
betteralign - structs field alignment static analyzer for Go
Thanks u/jxsl13, added in v0.2.1.
What are some alternatives?
When comparing dst and betteralign you can also consider the following projects:
goimports - [mirror] Go Tools
wastedassign - Go Linter: finds wasted assignment statements 🗑
go - The Go programming language
structslop - structslop is a static analyzer for Go that recommends struct field rearrangements to provide for maximum space/allocation efficiency.
maligned - Tool to detect Go structs that would take less memory if their fields were sorted.