Building Go Executables: Code Generation

Опубликовано: 02 Сентябрь 2022
на канале: Ardan Labs
3,903
70

In this example, ‪@MikiTebeka‬ wants to build a web server that serves random quotes. This could be done one of two ways:
Embed a text file in the executable and parse it every time
Do it once and generate a go file that generates a slice with all of the quotes

By utilizing go generate, we can detect errors at build time, which is better for our development workflow.

View the code used in this video: https://github.com/353words/building-go
More on code generation: https://go.dev/blog/generate

----

Access our online courses → https://www.ardanlabs.com/education

Attend a live training → https://www.ardanlabs.com/live-traini...

Other Links:
Website: https://www.ardanlabs.com/
Github: https://github.com/ardanlabs
Twitter:   / ardanlabs  


Смотрите видео Building Go Executables: Code Generation онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Ardan Labs 02 Сентябрь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,903 раз и оно понравилось 70 людям.