Fork me on GitHub

Project Notes

#024 World! in Go

exploring Go with the simplest example

Notes

This simple example demonstrates a few Go features:

  • package names. Executable commands must always use package main.
  • placing packages in unique import paths (lck/hello, lck/stringthings)
  • conventional project structure: src, pkg, bin folders
  • compile and build without makefiles (go install ..)
  • conventions for unit testing

Running the Example

Set the GOPATH to the folder containing the src. Here I’m running from the folder itself:

$ export GOPATH=$(pwd)

Run the tests:

$ go test lck/stringthings
ok    lck/stringthings  0.006s

Compile and run the executable it produces in the bin folder:

$ go install lck/hello
$ bin/hello
Hola Mundo
odnuM aloH

Credits and References

About LCK#24 Go
Project Source on GitHub Return to the Project Catalog

LittleCodingKata is my collection of programming exercises, research and code toys broadly spanning things that relate to programming and software development (languages, frameworks and tools).

These range from the trivial to the complex and serious. Many are inspired by existing work and I'll note credits and references where applicable. The focus is quite scattered, as I variously work on things new and important in the moment, or go back to revisit things from the past.

This is primarily a personal collection for my own edification and learning, but anyone who stumbles by is welcome to borrow, steal or reference the work here. And if you spot errors or issues I'd really appreciate some feedback - create an issue, send me an email or even send a pull-request.

LittleArduinoProjects LittleModelArt More on my blog