Summary of How I write HTTP services in Go after 13 years:
http.Handler
. configures its own muxer and calls out to routes.go
. includes setting up middleware, CORS, logging.
** Long argument lists - type safety in arguments.flags.NewFlagSet
inside run
. make a replacement os.Getenv
for tests and pass that to run
(or the real thing for main).Valid(ctx context.Context) (problems map[string]string)
http.Handler
and return one.run()
down to calling individual handler functions.
** Testing with the run function
** Waiting for readiness - loop on hitting a /healthz
endpoint until the server has started.Really good writeup of Roc’s decision to rewrite their compiler in Zig (original version written in Rust).
making a video out of an audio file and a single image:
$ ffmpeg -loop 1 -i cover.jpg -i audio_file.mp3 -c:v libx264 -tune stillimage -c:a aac -shortest -pix_fmt yuv420p output.mp4
Note: the image must have a height that’s divisible by 2.
“the hedgehog is too proud a bird to fly without a kick” - Russian proverb