At 12:15 AM

Go on windows tutorial (#golang)

Recently I invested some time to learn about new and popular language Go. I wanna give a test-drive, and since I have Windows XP and there is no GO official windows Go port, I needed to do some manual work.

This is the procedure:

    @echo off

    set GOROOT=c:\testing\go

    set GOOS=windows

    set GOARCH=386


    echo Set GOROOT=%GOROOT%

Start GO env. shell:

  • start DOS prompt, e.g. start/run/cmd
  • call set-go

Someone could ask why I didn’t put these vars to global system path (my computer right click, props, env. vars …). The answer is: I don’t do things like this, I like having more control over my shell environment. If you want to set it globally - check this link.

Now environment is ready, and I can write go programs, compile and run them like this:

  • create new file hello.go

        package main

        func main() {

            println(“Hello world.”)


  • go to the folder in your DOS-GO prompt and compile it - output is in hello.8:

        8g hello.go

  • link it - output is in hello.exe

        8l -o hello.exe hello.8

  • run it:

        > hello.exe

        Hello world.

Additional notes:

Good luck Go-ing!

blog comments powered by Disqus