Tuesday, May 9, 2017

GOPATH and Go Environment Variables

Gopher Tortoise Environment
I was a bit confused by The Internet's many comments on Go environment variables.  Here's my simple-minded take.

Go Environment Variables
  • go env will show you all the environment variables Go cares about and what Go believes them to be set to.
  • You can ignore most of them, they have details 
Basic GOPATH
  • Default GOPATH is $HOME/go.
  • If you're fine with this default, you don't need to set this.
  • I set it anyways, just for fun

Don't Set GOROOT or GOROOT_BOOTSTRAP

GOROOT is used to handle non-standard installations.  GOROOT_BOOTSTRAP is used when compiling Go from source.  In a future post I'll cover using these when building Go from source.

Using Multiple GOPATHs

When you're first starting out, plan on keeping your various projects together under $HOME/go.

Later, you may want to have multiple GOPATHs:

  • You might be working for different clients, and not run the risk of mingling their code or dependencies.
  • You might have particular revision control needs; for example, a larger project may have a subproject written in go.
I don't quite grok Go's project/subdirectory mapping at this time.  I'm studying it now and I'll write about it in the very near future.


blogodex = {"toc" : "GOPATH", "idx" : ["environment variables"]};

Thursday, May 4, 2017

Contributing Go Examples

Gophers are solitary animals, unlike
these prairie dogs.
How to write Go examples:
Use this guide to get started:
Notes if you're going through contribute.html for the first time:
  • If you have a specific review, use "git mail -r review...".  If you follow the document strictly, you will mail off the submission before it mentions this step.
  • The first time you build the entire go tree, you need to specify a GOROOT_BOOTSTRAP.  Details in How To Write Go Code, tl;dr for standard Mac install is: GOROOT_BOOTSTRAP=/usr/local/go ./all.bash
blogodex = {"idx" : "writing examples"};

Friday, April 28, 2017

Jumping on the Go Train!

Gopher Tortoise taking
a stroll.
I was going to post my miscellaneous notes over at EastBay Codehaus and just tag them with golang, but it seemed like it might be a bit more useful to collect them in one place.

If you're not familiar with my blogging style, it's mainly collections of notes to myself and problems I've worked through.  As such, it's sort of a running commentary of my ignorance.  I hope something here will be useful to you, and feel free to let me know what I've got wrong!

The photo is of a gopher tortoise strolling down a path.  Where is she going? What will she do when she arrives?



blogodex = {"toc" : "Introduction"};