Carl Johnson is a Go programmer who writes about Go tooling, CLI design, web development, and programming history.
HN commenters recommend his Go CLI architecture advice, praise his go:embed guide, and cite his argument against Gitflow.
I recommended avoiding Gitflow back in 2018:
> There are more complicated systems for branching like Git flow that have a separate “develop” branch and distinguish between “features” and “hot fixes”. These systems are fine if they fit your use case, but if a project releases code quickly, the level of complexity involved in Git Flow is unnecessary.
> Ideally, branches should be short lived. One strategy to allow merging a branch before a large feature is fully completed is to create a feature flag that lets the production system have the new code in it but in an inactive state.
https://blog.carlmjohnson.net/post/2018/git-gud/
One of my favourite abstraction advice comes from this article: https://blog.carlmjohnson.net/post/2020/go-cli-how-to-and-advice.
"You want one layer to handle user input and get it into a normalized form. You want one layer to do your actual task. And you want one layer to handle formatting and output to the user. Those are the three layers you always need."
The "do the task" layer can be abstracted again further. But starting it off as a monolithic layer, separated from input and output, is always the right call.
I use this technique for cache busting with Hugo: https://blog.carlmjohnson.net/post/2017/hugo-asset-pipeline/. I am not a web developer, so have translated that flow to a simple Bash script which I run on Netlify.
Hugo v0.43 has inbuilt cache busting on the roadmap, and Hugo v0.42 will probably be released in about a week.
It's a bit more advanced than what Rust macros provided last time I checked. You can shove whole directories in there and then traverse them or serve as static resources with pretty much one line of code.
Random blog post with a few examples:
https://blog.carlmjohnson.net/post/2021/how-to-use-go-embed/
They use comments for compilation directives, build instructions, code generation and other such stuff.
https://dave.cheney.net/2018/01/08/gos-hidden-pragmas
https://dave.cheney.net/tag/build-constraints
https://blog.carlmjohnson.net/post/2016-11-27-how-to-use-go-generate/
Yes, and it's super easy to do nowdays with embed since Go 1.16
https://blog.carlmjohnson.net/post/2021/how-to-use-go-embed/