go fish

Ive been playing with Go quite a bit lately, and found there to be quite a bit of boilerplate to get started with a new project. So I thew together gofish. Its a virtualenvwrapper inspired wrapper for working on Go projects in the Fish shell.

If youve used virtualenvwrapper (or virtualfish) the commands will be familiar to you.

To create a new go workspace:

$ mkgoworkspace project-name

This will created a project structure that looks like this:

/bin /pkg /src /zackkitzmiller /project-name main.go

The default namespace will be the currect users username, but that can be overridded by setting the GOFISH_NAMESPACE environment variable:

$ set -x GOFISH_NAMESPACE github.com/zackkitzmiller; and mkgoworkspace project-name

To switch the GOPATH:

$ goon project-name

To deactive a workspace completely:

$ gooff

The various commands all emit events, so you can listen for them in your fish config. The available events to listen to are:

  • gofish_workspace_will_be_created
  • gofish_workspace_created
  • gofish_workspace_will_activate
  • gofish_workspace_activated
  • gofish_workspace_will_deactivate
  • gofish_workspace_deactivated

The following example would send a growl notification on workspace activation

function announce –on-event gofish_workspace_activated command growlnotify -m \”Workspace: \” (basename $GO_CURRENT_WORKSPACE) \” activated\” -n gofish end

The following global environment variables will be available after a successful workspace activation:

  • $GOPATH - as expected

This is still just a work in progress. Let me know what you think. And as always, pull requests welcome.


  • multiple modules in same workspace
  • auto git?