/golang-tour

Learning Go and cool tricks discovered journeying on this path

golang-tour

Learning Go and cool tricks discovered journeying on this path

Please check this article for setting up a go development environment on an ubuntu distro. Or use the go ansible role from this repository to set up if you already have ansible installed.

I have also added 1 to every go filename to avoid conflicting with the current file worked on at any given time. Thus to run that source file as a go program simply remove the 1 behind the .go extension. Please do note also that since the intention was a successive tutorial of showing the design and concept of go language, each of these files have a main function which will conflict with another if both files are in .go extensions.

Tips and Tricks

hello.go

Having written this snippet to print "Hello Go!" at our terminal, we have two ways to run this application.

  • go run src/github.com/knoxknot/golang-tour/hello.go this runs and returns an output for the hello.go program.
  • go build github.com/knoxknot/golang-tour/ This builds several go packages into a single binary. Then we enter the binary name at the termninal and hit return to run. note that we omitted the "src" path name.