Rustaceans have been spoiled by Rust's clap
(or, at least, I think they have). The derive macros, the ergonomics, the fact
that you can describe an entire CLI with a struct and be done with it — it's
really nice. I've never actually used (never tried Rust), but every time I see
an example, I think "I wish Go had this." Go's standard flag package works,
and urfave/cli is the one I reach for when I
need more, but neither has that declarative feel. So I wrote
glap.
Define your CLI with a struct and some tags:
type CLI struct {
Config string `glap:"config,short=c,required,help=Path to config file"`
Verbose bool `glap:"verbose,short=v,help=Enable verbose output"`
Port int `glap:"port,short=p,default=8080,help=Port to listen on"`
Output string `glap:"output,short=o,possible=json|text|yaml,default=text,help=Output format"`
}
Parse it, use it. Subcommands, env var fallback, validators, groups,
conflicts/requires, colored help, shell completions — all there. It's still
beta, but it's working well for me.
Read more... The blog has officially been given comment support. While the articles
themselves are markdown files in the repository and are pre-rendered to json
during the build process, the comments are stored in a database. Authentication
is provided by GitHub OAuth.
For the time being, I'm going to have it so that I need to approve comments when
they are posted. Hopefully with the GitHub OAuth requirement there won't be too
much spam. Guess we shall find out - that was the reason I removed comment
support in the first place.
Unfortunately, I no longer have the comments from older vimtips.org articles.
Not sure what happened to them. I guess when I turned them off I forgot to back
them up. Oh well 😉
Read more... When I was making the current version of this blog, there was a lot of
discussion on Twitter around improving load times and responsiveness on dynamic
websites, complete with lots of demonstrations of instant load times even for
things that access the database, like searches. I decided to see what I could
pull off with this little site, served from a cheap VPS. I was able to get it to
a perfect score on Lighthouse, and indeed, if you click around on the links or
use the search box, you will see that things load pretty much instantly.

Read more... Do you use distroless? Have you tried to build a distroless docker image for
your Go project, only to see an error like
/bin/foo: no such file or directory? Maybe you spent a bunch of time trying to
figure out why that file isn't there, only to find out that it IS there, but
you're still getting the error?
This post is for you!
Read more...