matthieudelaro / nut

Nut: the development environment, containerized.
GNU General Public License v3.0
258 stars 16 forks source link

Can't install on OSX #30

Closed OmgImAlexis closed 7 years ago

OmgImAlexis commented 7 years ago

After entering the nut dir and running the next OSX step I end up with an error.

➜  nut git:(master) ✗     docker run -i -t --rm -v $PWD:/go/src/github.com/matthieudelaro/nut -w /go/src/github.com/matthieudelaro/nut matthieudelaro/golang:1.6-cross env GOOS=darwin GOARCH=amd64 go build -o nut

vendor/github.com/fsouza/go-dockerclient/client_unix.go:9:2: cannot find package "context" in any of:
        /go/src/github.com/matthieudelaro/nut/vendor/context (vendor tree)
        /usr/local/go/src/context (from $GOROOT)
        /go/src/context (from $GOPATH)
matthieudelaro commented 7 years ago

Hi @OmgImAlexis,

Thanks for reporting this issue, and sorry for working on this so late. I found the ground of the failure, and some quick fixes. According to this issue, the package "context" is now part of the standard library in Go 1.7

And it turns out, that go-dockerclient now works only with Go 1.7+

So a quick fix 1) is to use govendor sync instead of govendor fetch +missing (in OSX step I ) (starting again from a fresh clone of the repo). That will force govendor to fetch dependencies with the same version as in the last commit (reading from vendor.json) The drawback of this solution, is that it prevent us from leveraging updates.

I'd rather update nut to Go 1.7 You can already use the quick fix 2): compile using the golang:1.7 docker image: docker run -i -t --rm -v $PWD:/go/src/github.com/matthieudelaro/nut -w /go/src/github.com/matthieudelaro/nut golang:1.7 env GOOS=darwin GOARCH=amd64 go build -o nut

I'm trying to do a golang:1.7 image with ready-to-use cross-compilation and govendor, but it fails at the last step of the Dockerfile:

Step 10/10 : RUN go get -u github.com/kardianos/govendor
 ---> Running in fc19bad07bfa
package go/ast: unrecognized import path "go/ast" (import path does not begin with hostname)
package go/parser: unrecognized import path "go/parser" (import path does not begin with hostname)
package go/printer: unrecognized import path "go/printer" (import path does not begin with hostname)
package go/token: unrecognized import path "go/token" (import path does not begin with hostname)

Any idea? I tried some stuff with GOROOT, but it didn't do the trick, and I don't have anytime to go on with this now.

Until one find a better solution, I update the README with fix 1): docker run --rm -v $PWD:/go/src/github.com/matthieudelaro/ -w /go/src/github.com/matthieudelaro/ matthieudelaro/golang:1.6-cross bash -c 'git clone https://github.com/matthieudelaro/nut.git --progress && cd nut && govendor sync

matthieudelaro commented 7 years ago

Hi @OmgImAlexis,

Bug fixed with commit e88c156 :) I'm closing this issue now. Feel free to ask again, in case it still doesn't work for you, starting from a fresh clone of the repository.