To test small snippets of Go code you can use one of several on-line playgrounds.
The Go Playground or slightly nicer The Go Play Space.
Playground has some limitations:
Playground gives you a permanent link to code snippet for sharing with others.
Glot.io can execute code in multiple languages, including Go.
Its limitations are:
You can create shareable snippets.
Repl.it can execute code in multiple languages, including Go.
Its limitations are: