petejkim / goop

A simple dependency manager for Go (golang), inspired by Bundler.
MIT License
779 stars 45 forks source link

Build packages with goop? #34

Closed dzrw closed 9 years ago

dzrw commented 9 years ago

I've been able to use goop with a trivial main.go example, but I've been unable to figure out how to use goop with a folder structure containing a package main and one or more other packages.

My folder structure looks like below:

Goopfile
src/myproj
   - main.go
   - client/client.go

I'm using goop go build src/myproj/main.go to build package main, but for the life of me I can't figure out how to build/import the client package. I would really appreciate an example that works.

tikiatua commented 9 years ago

Maybe it would work if you change your gopath environment variable first by running

> eval $(goop env)
> go build src/myproj/main.go
dzrw commented 9 years ago

I was able to symlink a location under the .vendor/src root to a normal top-level src folder containing all of my go code, and then goop go run src/myproj/main.go just works. To put a finishing touch on it, I committed the symlink to my git repo (.vendor is ignored in my setup).

~/Code/p/g/.vendor/src/github.com/politician> ls -l
lrwxr-xr-x  1 fak  staff  15 Feb 10 18:24 myproj -> ../../../../src

This is pretty much the ideal development environment for Go now. goop relieves me of the burden of managing the disaster that is GOPATH and workspaces, the symlink allows me to have a clean top-level at the repository root, and a Makefile makes all of the other weirdness sufferable (e.g. packaging).

> ls -a
.git .gitignore .vendor Goopfile Goopfile.lock Makefile README.md src

Currently, support for goop go get is a non-requirement, so I haven't tried it; but if it doesn't work, then might add support for my folder structure in the future.