pier-oliviert / irrigation

Go web server for controlling your sprinklers with your Raspberry Pi.
http://pothibo.com/2013/05/control-your-sprinklers-on-your-raspberry-pi
28 stars 8 forks source link

Not go-gettable #1

Closed BurntSushi closed 11 years ago

BurntSushi commented 11 years ago

I should be able to simply run

go get github.com/pothibo/irrigation

to download and build your package. But I get this in a clean $GOPATH:

[andrew@Liger ~] go get github.com/pothibo/irrigation
package github.com/pothibo/irrigation
        imports github.com/globocom/config
        imports github.com/howeyc/fsnotify
        imports launchpad.net/~niemeyer/goyaml/beta
        imports github.com/gorilla/pat
        imports github.com/gorilla/context
        imports github.com/gorilla/mux
        imports irrigation/db: unrecognized import path "irrigation/db"
package github.com/pothibo/irrigation
        imports github.com/globocom/config
        imports github.com/howeyc/fsnotify
        imports launchpad.net/~niemeyer/goyaml/beta
        imports github.com/gorilla/pat
        imports github.com/gorilla/context
        imports github.com/gorilla/mux
        imports irrigation/helpers: unrecognized import path "irrigation/helpers"
package github.com/pothibo/irrigation
        imports github.com/globocom/config
        imports github.com/howeyc/fsnotify
        imports launchpad.net/~niemeyer/goyaml/beta
        imports github.com/gorilla/pat
        imports github.com/gorilla/context
        imports github.com/gorilla/mux
        imports irrigation/models: unrecognized import path "irrigation/models"
package github.com/pothibo/irrigation
        imports github.com/globocom/config
        imports github.com/howeyc/fsnotify
        imports launchpad.net/~niemeyer/goyaml/beta
        imports github.com/gorilla/pat
        imports github.com/gorilla/context
        imports github.com/gorilla/mux                                                                    
        imports irrigation/scheduler: unrecognized import path "irrigation/scheduler" 

Even if I follow your instructions I get build errors looking for gopi:

[andrew@Liger gotmp] cd src/github.com/pothibo/irrigation/
[andrew@Liger irrigation] go get ./...
package irrigation/db: unrecognized import path "irrigation/db"
package irrigation/helpers: unrecognized import path "irrigation/helpers"
package irrigation/models: unrecognized import path "irrigation/models"
package irrigation/scheduler: unrecognized import path "irrigation/scheduler"
package github.com/coopernurse/gorp
        imports github.com/mattn/go-sqlite3
        imports gopi: unrecognized import path "gopi"

Is there any reason why are you aren't qualifying your import paths? e.g., instead of irrigation/db, you'd use github.com/pothibo/irrigation/db. If you fully qualified all your import paths. You should do this for other packages too, like github.com/pothibo/gopi instead of just gopi.

If you do that, then people will be able to just run go get github.com/pothibo/irrigation and things will work. :-)

pier-oliviert commented 11 years ago

You are right, and it was the expected behavior (to only go get the source). All those subpackage are in this project. Have you tried cloning the repo?

BurntSushi commented 11 years ago

I don't believe gopi is in this repo---it's a separate repo.

Is there any reason why you don't want it to be go gettable?

pier-oliviert commented 11 years ago

I think I know why it was failing. Let me do some quick test and commit the changes.

gopi is located at github.com/pothibo/gopi. Since I am developping on the same $GOPATH I forgot to make the imports relative to github.com. Shouldn't take long before the fix

pier-oliviert commented 11 years ago

Well it might take a bit more, gotta install Go on my mac. Had a power outage 2 days ago and the Pi wasn't protected so it seems it fried. :(

pier-oliviert commented 11 years ago

Can you please try go get again and tell me if it works I can't fully test irrigation on an imac due to gopi being specific to the pi. I ordered a new Pi but I won't be able to test until I get a new one.

BurntSushi commented 11 years ago

Works. :-)

[andrew@Liger ~] go get github.com/pothibo/irrigation
[andrew@Liger ~]

I think you should also be able to include assets in your git repo too so that your executable can automatically find them at run time. (See build.SrcDirs.)

That's a major bummer to hear your Pi got fried. :-( Mine is stuffed in a closet somewhere. I've been testing this on Linux/x64.

pier-oliviert commented 11 years ago

Great news!

I've heard about build.SrcDirs but didn't have time yet to play with it. You might want to be careful with using irrigation on your machine. gopi( wiringPi) uses mmap to assign some address. Behavior on x64 might be undefined.

BurntSushi commented 11 years ago

Aye. I'm just passing through. If and when I get a house with an irrigation system, I'll be sure to come back. :-) Good luck with the project!