<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5841062878012885253</id><updated>2024-10-04T20:22:35.604-07:00</updated><category term="Intro"/><category term="Other"/><title type='text'>Adventures with Go-lang</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://if-golang.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5841062878012885253/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://if-golang.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>sudhakar</name><uri>http://www.blogger.com/profile/13737440750477809930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5841062878012885253.post-9115859080540716902</id><published>2011-11-24T20:05:00.001-08:00</published><updated>2011-11-24T22:29:08.266-08:00</updated><title type='text'>Installing Go on Windows 7</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Go-lang celebrated its &lt;a href=&quot;http://blog.golang.org/2011/11/go-programming-language-turns-two.html&quot;&gt;second birthday&lt;/a&gt; 2 weeks back. Although *nix ports were fully tested, windows port is &lt;a href=&quot;http://code.google.com/p/go-wiki/wiki/WindowsSupport&quot;&gt;not fully complete&lt;/a&gt;. Let’s see how to get the experimental windows port work.  &lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Start downloading &lt;a href=&quot;http://code.google.com/p/gomingw/downloads/detail?name=gowin386_release.r60.3_installer.exe&amp;amp;can=2&amp;amp;q=&quot;&gt;experimental x32 windows port&lt;/a&gt; of Go installer from the &lt;a href=&quot;http://code.google.com/p/go-wiki/wiki/WindowsSupport&quot;&gt;gomingw download page&lt;/a&gt;. It’s always a safer bet to start with x32 as it will work with both 32 bit &amp;amp; 64 bit computers &amp;amp; at the same time we will have one less problem to deal with. Windows port uses &lt;a href=&quot;http://en.wikipedia.org/wiki/MinGW&quot;&gt;MinGW&lt;/a&gt; (Minimalist &lt;a href=&quot;http://en.wikipedia.org/wiki/GNU&quot;&gt;GNU&lt;/a&gt; for Windows) which is a native software port of the GCC and Binutils for use in the development of native Microsoft Windows applications&lt;/li&gt;
&lt;li&gt;Once the installer is downloaded, installation is straightforward. Just click next-next-next &amp;amp; complete the installation&lt;/li&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMaiLQ4RM3ilg3V0gFcgrXXmf05-YqMQq_o14gu9AgGihgVJCovslncIx7xZGCpy-CdHBEj1C7Xz2imb4q1oEjXm9NmrEQSeL82F2zG5GzY9SxR5Rr11FsMNJZ1ePNPW2_5fQPx9hUEx4/s1600/golang-installer-step1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;229&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMaiLQ4RM3ilg3V0gFcgrXXmf05-YqMQq_o14gu9AgGihgVJCovslncIx7xZGCpy-CdHBEj1C7Xz2imb4q1oEjXm9NmrEQSeL82F2zG5GzY9SxR5Rr11FsMNJZ1ePNPW2_5fQPx9hUEx4/s320/golang-installer-step1.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ_tVos17eoslb7pG9vvWzHxKVkToxMvyAARKI76qAP1CO85k9bM6WMiZz4L6q-i9Tvm55wCPQlfasA-eM0AZqHlF1VNCPyu1TSVVC8HjHpW8fRuXyt686Vh_qLJ899hWIt-zVc21gLXo/s1600/golang-installer-step2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;229&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ_tVos17eoslb7pG9vvWzHxKVkToxMvyAARKI76qAP1CO85k9bM6WMiZz4L6q-i9Tvm55wCPQlfasA-eM0AZqHlF1VNCPyu1TSVVC8HjHpW8fRuXyt686Vh_qLJ899hWIt-zVc21gLXo/s320/golang-installer-step2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh10UsmbNLdhVVve0oqXrqrQ9qee-B6gLiL6fY9Qam0xMV5hTZLTdexPERePjJ2Urp6nXqoshjsdrzSz5ttlnk0hZIhyphenhyphenBY38wljxVF-hdh4jyhVQVr9osJVHYUhMLwTHTdOfupVz8OfRoU/s1600/golang-installer-step3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;229&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh10UsmbNLdhVVve0oqXrqrQ9qee-B6gLiL6fY9Qam0xMV5hTZLTdexPERePjJ2Urp6nXqoshjsdrzSz5ttlnk0hZIhyphenhyphenBY38wljxVF-hdh4jyhVQVr9osJVHYUhMLwTHTdOfupVz8OfRoU/s320/golang-installer-step3.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;li&gt;Installation will take a minute or two to complete. Once done, there will be a start up entry created for removing go,&lt;/li&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgq_gwtjoj66tQDdRRkfYQd8eiXvVPnrXdWcuzjqJ14jy5eccS5mz_MKQMbGmE2C4pvRweQB4qSuREpPATsfJRfbs3XgKuEgON9YDqvNcy8fzWOwgahO0x2niPzBx24vkzjQzfAwsCzt4o/s1600/golang-installer-startmenu.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgq_gwtjoj66tQDdRRkfYQd8eiXvVPnrXdWcuzjqJ14jy5eccS5mz_MKQMbGmE2C4pvRweQB4qSuREpPATsfJRfbs3XgKuEgON9YDqvNcy8fzWOwgahO0x2niPzBx24vkzjQzfAwsCzt4o/s200/golang-installer-startmenu.jpg&quot; width=&quot;146&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;li&gt;but how do we start it?&lt;/li&gt;
&lt;li&gt;Lets check the system parameters to see if there is any change in the path variable&lt;/li&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG108102my6f-QvWFF4O_QYxjI23D2QEn6wlMltPKlmmdE5_7IQKvSyb3u86Qhort1jTQoQfpGmPx8m6qO0APbJ5OWGRUJgWi-1ROTQL5KdgtMTo1nylhgbPv8AB6VD5AiSnU0oo6MRAo/s1600/golang-installer-evn_vars.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;127&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG108102my6f-QvWFF4O_QYxjI23D2QEn6wlMltPKlmmdE5_7IQKvSyb3u86Qhort1jTQoQfpGmPx8m6qO0APbJ5OWGRUJgWi-1ROTQL5KdgtMTo1nylhgbPv8AB6VD5AiSnU0oo6MRAo/s320/golang-installer-evn_vars.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;li&gt;Yes we do. So we run go from the command line.&lt;/li&gt;
&lt;li&gt;BTW, the go compiler has some odd names (6g for the 64-bit x86, 8g for the 32-bit x86, and more). For now we will use 8g.exe as the compier &amp;amp; 8l.exe as the linker&lt;/li&gt;
&lt;li&gt;Create a d:\helloworld.go with following contents

&lt;pre&gt;&lt;code&gt;
package main

import fmt &quot;fmt&quot; // Package implementing formatted I/O.

func main() {
    fmt.Printf(&quot;Hello, world; or ?a??µ??a ??sµe; or ????? ??\n&quot;)
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Lets compile using the 8g compiler
&lt;pre&gt;&lt;code&gt;
D:\&amp;gt;8g helloworld.go
helloworld.go:1: invalid identifier character 0xfeff
helloworld.go:1: package statement must be first
helloworld.go:1: non-declaration statement outside function body
helloworld.go:1: syntax error: unexpected name, expecting semicolon or newline

&lt;/code&gt;&lt;/pre&gt;
That sucks. It sounds more like an encoding problem. Lets convert it to UTF-8 without BOM encoding&lt;/li&gt;
&lt;li&gt;Lets retry again&lt;pre&gt;&lt;code&gt;
D:\&amp;gt;8g helloworld.go
D:\&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiGWzDeVmRzeRC8GBo_4rFRjuEWC4UkvmIi4YpIYsf7p-fJoVNeIFooItn-GWZyHz9at8j5hPhIQoD0vsOvFoydShFAkrHkEKsZAgotHgWvYDyNXnh7asOhe7JoiG2KEdgU03zv8wrANM/s1600/helloworld.8.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;20&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiGWzDeVmRzeRC8GBo_4rFRjuEWC4UkvmIi4YpIYsf7p-fJoVNeIFooItn-GWZyHz9at8j5hPhIQoD0vsOvFoydShFAkrHkEKsZAgotHgWvYDyNXnh7asOhe7JoiG2KEdgU03zv8wrANM/s400/helloworld.8.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
voila!! it worked. Ok. I figured it out. I had the helloworld.go in &quot;ASCII&quot; encoding where as my command prompt expects UTF-8.&lt;/li&gt;
&lt;li&gt;Now we can use 8l linker to convert .8 intermediate files to final executable
&lt;br /&gt;&amp;nbsp;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9JPhQp_VINVIYqSmrRrrtyTKl_bC3oQ3XZHwj3mimshG_LMK5X-u81tJuy7VHFefgWZKX1ZjYCr2Av9XSu2UdFqdk269DlGdqfLr8DDgJsoNF1nMAAKNAuvWyyADxba_O_vc0NRaOio/s1600/8.out.exe.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9JPhQp_VINVIYqSmrRrrtyTKl_bC3oQ3XZHwj3mimshG_LMK5X-u81tJuy7VHFefgWZKX1ZjYCr2Av9XSu2UdFqdk269DlGdqfLr8DDgJsoNF1nMAAKNAuvWyyADxba_O_vc0NRaOio/s1600/8.out.exe.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;li&gt;Ah hah..finally the &quot;Hello World&quot; in Go.&lt;/li&gt;
&lt;/ol&gt;
At first it might look like lot of steps to get the hello world work. But trust me all these things will be taken care of by the IDE once we have it configured. Also folks at Go claim that go-compiler &amp;nbsp; is faster than any of the other compilers out there. In any case, it should be much faster than javac.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
First step always takes time. Once we are set, we can start exploring its strengths. So have you got your &quot;hello world&quot; out of your way?&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://if-golang.blogspot.com/feeds/9115859080540716902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://if-golang.blogspot.com/2011/11/installing-go-on-windows-7.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5841062878012885253/posts/default/9115859080540716902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5841062878012885253/posts/default/9115859080540716902'/><link rel='alternate' type='text/html' href='http://if-golang.blogspot.com/2011/11/installing-go-on-windows-7.html' title='Installing Go on Windows 7'/><author><name>sudhakar</name><uri>http://www.blogger.com/profile/13737440750477809930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMaiLQ4RM3ilg3V0gFcgrXXmf05-YqMQq_o14gu9AgGihgVJCovslncIx7xZGCpy-CdHBEj1C7Xz2imb4q1oEjXm9NmrEQSeL82F2zG5GzY9SxR5Rr11FsMNJZ1ePNPW2_5fQPx9hUEx4/s72-c/golang-installer-step1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5841062878012885253.post-2297755511334390461</id><published>2011-11-23T22:22:00.001-08:00</published><updated>2012-02-26T08:28:12.545-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Intro"/><category scheme="http://www.blogger.com/atom/ns#" term="Other"/><title type='text'>Learning Go</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi everyone! This is an attempt to document my learnings on the new language &lt;b&gt;GO&lt;/b&gt;. I will try to keep the post short, simple &amp;amp; as much technical as possible. So checkit out from time to time.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://if-golang.blogspot.com/feeds/2297755511334390461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://if-golang.blogspot.com/2011/11/learning-go.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5841062878012885253/posts/default/2297755511334390461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5841062878012885253/posts/default/2297755511334390461'/><link rel='alternate' type='text/html' href='http://if-golang.blogspot.com/2011/11/learning-go.html' title='Learning Go'/><author><name>sudhakar</name><uri>http://www.blogger.com/profile/13737440750477809930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>