On 18/01/15 03:23, Chris Shroba wrote:
> I'm working on a project that has several subprojects. Some of these
> are in Go and some of these will be in Python. I am trying to figure
> out the best way to structure this project as a whole, and would love
> any advice. My current thought is to do something like this:
>
> |myproject
> ├── go-subproject1/
> │ ├── bin/
> │ ├── pkg/
> │ └── src/
> │ ├── bar.go
> │ ├── foo.go
> │ └── main.go
You need another subdirectory under src - you don't want to put your go
files in the root.
> ├── go-subproject2/
> │ ├── bin/
> │ ├── pkg/
> │ └── src/
> │ ├── bar.go
> │ ├── foo.go
> │ └── main.go
> └── python-subproject/
> └── src/
> └── com/
> ├── __init__.py
> └── myusername/
> ├── __init__.py
> └── api/
> ├── __init__.py
> ├── bar.py
> └── main.py|
>
>
> I could put a one-line shell script in each Go subproject's root
> directory to export the correct GOPATH for that subproject to run when I
> am working on that subproject
I've used pretty much that approach. It has one disadvantage though
assuming that the above is all checked into one version control system.
When you do go get, it will make extra directories in
myproject/go-subproject/src and these will annoy you when you do git
status, etc. You can .gitignore them, vendor them, or use a GOPATH with
more than one directory in (which works but has disadvantages).
> One other solution I thought of was to simply break out the subprojects
> into their own repositories (instead of having one repo for everything),
> and namespacing them as "projectname-api", "projectname-queuer", etc.,
> but I think I would rather contain everything as one repository.
You might find that easier
--
Nick Craig-Wood <
ni...@craig-wood.com> --
http://www.craig-wood.com/nick