Your question seems similar to my recent question about code
layout<https://groups.google.com/d/topic/golang-nuts/mwLeVoNkvPw/discussion>.
Let me try to answer with an example. Suppose you want to create a
application 'politics' that depends on two of your libraries, 'corruption'
and 'greed'. The app and both libraries live on github, each in its own
repository. Your code layout would look like this:
$GOPATH/
src/
github.com/
your_username/
corruption/
.git/
corruption.go
greed/
.git/
greed.go
politics/
.git/
politics.go
Each folder under src/github.com/your_username/ is the root of a git
checkout. Let's assume we are starting from scratch, and the repos for all
three packages have already been initialized on github. Use the
"Initialize this repository with a README" option so your repos can be
cloned immediately. You would create the project like this:
cd ~
mkdir mygo # Go workspace
export GOPATH=~/mygo
cd $GOPATH
mkdir -p src/github.com/your_username
cd src/github.com/your_username
git clone g...@github.com:your_username/corruption.git
git clone g...@github.com:your_username/greed.git
git clone g...@github.com:your_username/politics.git
Create your greed & corruption libraries. You would then import them into
politics.go like this:
import(
"github.com/your_username/corruption"
"github.com/your_username/greed"
)
During development you can build e.g. the greed library by itself with the
command "go build ...greed". To compile the politics app and its
dependencies all together, you just need to give the command "go build
...politics".
On Fri, Apr 27, 2012 at 1:01 PM, Jeremy Villalobos <
jeremyvillalo
...@gmail.com> wrote:
> This may seem fairly obvious, but it is not in the documentation pages.
> How do I manage packages on my own project ? If I want to make a module
> for some related services for example ? The equivalent of creating a
> package in Java ( com.my.company. )
> How do I create a library for internal use ?
> How do I compile multiple files ?
> What is the standard makefile or ant script that is intended to be used by
> go projects ?
> Thank you.