Wednesday, February 1, 2017

Learning to "go"

I know this is (was) my cycling blog, but for the meantime it will have to also work as a tech blog.

I'm learning a new language .. "go" - to check that I have the environment set up, here's the ubiquitous "Hello World" :-

1
2
3
4
5
6
7
package main

import "fmt"

func main() {
 fmt.Printf("Hello, Garth.\n")
}

which produces the desired output :-

1
2
Garths-MacBook-Pro:hello garthjl$ $GOPATH/bin/hello
Hello, Garth.

Well, it may be pretty boring, but it proves that the environment is set up correctly, it illustrates using hilite.me to format the go code AND the bash session output :-)

Nicely enough, Visual Studio Code (on my MacBook Pro) has 'Go' Extensions and tools (https://github.com/Microsoft/vscode-go"), see the 'Using' section at that URL on how easy it is to set up (I haven't installed 'delve' yet, lets learn how to walk before we run)

Notes to self : switch blogger to HTML before inserting any pretty printed HTML snippets [sigh]

No comments:

Post a Comment