{"id":10390,"date":"2014-12-23T13:46:22","date_gmt":"2014-12-23T18:46:22","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=10390"},"modified":"2014-12-23T13:46:22","modified_gmt":"2014-12-23T18:46:22","slug":"generating-go-code","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/12\/23\/generating-go-code\/","title":{"rendered":"Generating Go Code"},"content":{"rendered":"<p><a href=\"http:\/\/blog.golang.org\/generate\">Rob Pike<\/a> (via <a href=\"https:\/\/twitter.com\/swannodette\/status\/547239352485834752\">David Nolen<\/a>):<\/p>\n<blockquote cite=\"http:\/\/blog.golang.org\/generate\"><p>Programs that write programs are therefore important elements in software engineering, but programs like Yacc that produce source code need to be integrated into the build process so their output can be compiled. When an external build tool like Make is being used, this is usually easy to do. But in Go, whose go tool gets all necessary build information from the Go source, there is a problem. There is simply no mechanism to run Yacc from the go tool alone.<\/p><p>Until now, that is.<\/p><p>    The <a href=\"http:\/\/blog.golang.org\/go1.4\">latest Go release<\/a>, 1.4,\n    includes a new command that makes it easier to run such tools.\n    It&rsquo;s called <code>go<\/code><code>generate<\/code>, and it works by scanning for special comments in Go source code\n    that identify general commands to run.\n    It&rsquo;s important to understand that <code>go<\/code><code>generate<\/code> is not part of <code>go<\/code><code>build<\/code>.\n    It contains no dependency analysis and must be run explicitly before running <code>go<\/code><code>build<\/code>.\n    It is intended to be used by the author of the Go package, not its clients.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Rob Pike (via David Nolen): Programs that write programs are therefore important elements in software engineering, but programs like Yacc that produce source code need to be integrated into the build process so their output can be compiled. When an external build tool like Make is being used, this is usually easy to do. But [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[846,46,941,71],"class_list":["post-10390","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-go-language","tag-languagedesign","tag-macros","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=10390"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10390\/revisions"}],"predecessor-version":[{"id":10391,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10390\/revisions\/10391"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=10390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=10390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=10390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}