Re:How I write HTTP services in Go after 13 years
by perbu on Saturday February 10, 2024 @11:02AM
(#39327160)
I assume you mean main() and not main.go.
main() is the only place where you can't return an error. In order to keep as much of the code as idiomatic as possible you just call something like run() where you can do so.
In addition there is the testing aspect. You can't invoke main() from your tests.
main() is the only place where you can't return an error. In order to keep as much of the code as idiomatic as possible you just call something like run() where you can do so.
In addition there is the testing aspect. You can't invoke main() from your tests.