No description, website, or topics provided.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Go localinstall

Sometimes you need to run local install for development.

But Go don't let you run something go install ., it would complain you about:

go install: no install location for ...

So that you need to put your repository into the $GOPATH structure manually to make a install locally.

For most people there are some solutions:

  1. create src/, pgk/, bin/ structure in the repository, then add current directory to $GOPATH.
  2. copy or link repository path to $GOPATH by commands.

To the first solution, most packages are not in this kind of structure.

To the second solution, copying or linking paths are tiresome.


To let something like this work:

import ""
import "reallycool"

we need to link current directory to GOPATH

ln -s $GOPATH/src/ .
ln -s $GOPATH/src/reallycool .

local-install stragegy:

  1. find local install config file
  2. Get import path from repository path (git, hg ... etc), or package name.
  3. use GOPATH to link package repository
  4. run build