Re:Better HTTP server routing in Go 1.22
by flakes on Monday October 16, 2023 @10:12PM
(#37909624)
I very much dislike import side effects in any language. Im a lot happier where thing.Register() is still forced to happen in the main function.
Still, I can understand it for some components like loggers to not add boiler plate to every library. However, I was very uneasy to see that enabling gzip decompression in a gRPC server is done through a magic _ import. You have to initialize the server anyways, so why not just make it an explicit function argument?
Still, I can understand it for some components like loggers to not add boiler plate to every library. However, I was very uneasy to see that enabling gzip decompression in a gRPC server is done through a magic _ import. You have to initialize the server anyways, so why not just make it an explicit function argument?