Go Language


What is Go Language. Wikipedia says: “Go (often referred to as golang) is a free and open source programming language created at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. It is a compiled, statically typed language in the tradition of Algol and C, with garbage collection, limited structural typing, memory safety features and CSP-style concurrent programming features added.”

The Getting Started page guides you through getting Go installed and testing your installation with a “Hello world” command line program. I installed it on Windows 10. It wasn’t difficult. On the Getting Started page mentioned above, pay close attention to the section called Test your installation. I installed Go on my D rive instead of the normal C drive. The default location for my Go source code is a “custom made” folder on my D drive that has nothing to do with “Users”. I therefore needed to set the GOPATH environment variable as the article says, as well as adding the GOROOT environment variable to D:\GO (I installed it on the D drive because there is not a lot of room left on my C drive, which is a fairly small SSD).

After getting the installation working it’s time to do some homework and learn or brush up on your Go. Have a look at the How to Write Go Code page.

Here is an example of a first, or second Go Language program you might write.

package main
import ( "fmt"
         "bufio"
         "os"
       )
func main() {
    fmt.Printf("hello, world\n")
	fmt.Print("Press 'Enter' to continue...")
    bufio.NewReader(os.Stdin).ReadBytes('\n') 
}

If you open a command prompt in Windows and you create a file called hello.go in the correct directory, compile it and then run it by typing hello and pressing enter you will get the following results if you then press Enter as the program suggests.

More Resources

If you are looking for some information on the Go Language, try this website called Go Resources. There are more resources at DevFreeBooks. If you are dying to start writing snippets of code, try Go by Example on that web page.

Leave a comment

Your email address will not be published. Required fields are marked *