Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
  1. $GOPATH is the well known place where go looks for things and installs built things.
  2. go install <path> <path> is relative to $GOPATH\src.

For example, the following will attempt to compile code found in $GOPATH/src/my-app:

$> go install my-app
  1. go install doesn't care if package <name> matches the fs path structure.

  2. When the name of a package is main, that package ends up in $GOPATH/bin as an executable.

  3. You must define main func when the package is main - aka you wanted an executable package. If you don't define main, you'll see:

hello

runtime.main: call to external function main.main runtime.main: main.main: not defined runtime.main: undefined: main.main


1. Any package installed in `$GOPATH/pkg` can be `import`ed.

1. Dependencies `imported` will be built and installed when the parent is built
 and installed... turtles!
1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.