{"id":142,"date":"2018-10-05T16:29:18","date_gmt":"2018-10-05T16:29:18","guid":{"rendered":"http:\/\/kabiliravi.com\/?page_id=142"},"modified":"2019-07-21T13:47:54","modified_gmt":"2019-07-21T13:47:54","slug":"helloworld","status":"publish","type":"page","link":"http:\/\/kabiliravi.com\/index.php\/software\/programming\/my-go-tutorial\/helloworld\/","title":{"rendered":"Write your First Application (Hello World) with Go"},"content":{"rendered":"<ol>\n<li>Create a folder anywhere you like and call it anything you want. I called it <strong>helloworld-basic<\/strong> and you can find it in this repository:<br \/>\nhttps:\/\/github.com\/gotutorial\/helloworld.git<\/li>\n<li>Create a file with the extension of <strong>.go<\/strong>. You can give any name to that file. I named it <strong>main.go<\/strong>.<\/li>\n<li>Add following lines in <strong>main.go<\/strong> file\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package main\r\n\r\nimport \"fmt\"\r\n\r\nfunc main() {\r\n  fmt.Println(\"Hello World\")\r\n}<\/pre>\n<\/li>\n<li>You can run your first Go Hello World application simply using <strong>go run<\/strong> command and you should be able to see &#8220;Hello World&#8221; text below your command execution.\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ go run main.go\r\nHello World\r\n<\/pre>\n<\/li>\n<li>You can also build an standalone executable file of your application using following command and run it.\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ go build main.go<\/pre>\n<p>You should be able to find an execution file with the same name <strong>main<\/strong> without any extension along with your <strong>main.go<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ ls\r\nmain  main.go\r\n<\/pre>\n<p>And run the executable file like this:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ .\/main\r\nHello World\r\n<\/pre>\n<p>&nbsp;<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Create a folder anywhere you like and call it anything you want. I called it helloworld-basic and you can find it in this repository: https:\/\/github.com\/gotutorial\/helloworld.git Create a file with the extension of .go. You can give any name to that file. I named it main.go. Add following lines in main.go file package main import &#8220;fmt&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":131,"menu_order":2,"comment_status":"open","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-142","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/comments?post=142"}],"version-history":[{"count":7,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/142\/revisions"}],"predecessor-version":[{"id":162,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/142\/revisions\/162"}],"up":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/131"}],"wp:attachment":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/media?parent=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}