thoas / picfit

An image resizing server written in Go
http://bit.ly/1E7rSoi
MIT License
2.14k stars 177 forks source link

Downstream changes in mholt/binding has broken build #35

Closed steevee closed 9 years ago

steevee commented 9 years ago

First time gets or installs updating with go get -u github.com/thoas/picfit reveals a downstream change to the mholt/binding package (https://github.com/mholt/binding/commit/58246f9c398c372b9ea02fa16cc5ee6d054285f7) that breaks builds:

# github.com/thoas/picfit/application
../../github.com/thoas/picfit/application/handlers.go:43: cannot use multipartForm (type *MultipartForm) as type binding.FieldMapper in argument to binding.Bind:
    *MultipartForm does not implement binding.FieldMapper (wrong type for FieldMap method)
        have FieldMap() binding.FieldMap
        want FieldMap(*"net/http".Request) binding.FieldMap
steevee commented 9 years ago

Sorry, I didn't realise godep was at play here, I was just pulling in go get github.com/thoas/picfit. Will clone and run make build - as per your instructions :blush:

thoas commented 9 years ago

@steevee don't hesitate if you find the documentation not clear on this subject.

steevee commented 8 years ago

@thoas thanks. I was creating a Docker image to run picfit in. I was successful with the following Dockerfile and manually fixing a raven-go submobile reference issue (godep would fail on first attempt running the Dockerfile, so I had to enter the container, run make build again, and commit the image).

FROM golang:1.5.1

ENV GO15VENDOREXPERIMENT 1

RUN mkdir -p /go/src/github.com/thoas 

WORKDIR /go/src/github.com/thoas
RUN git clone https://github.com/thoas/picfit.git

WORKDIR /go/src/github.com/thoas/picfit
# Currently fails, needs manual intervention
RUN make build 

# Assumes a volume has been mounted to the path /etc/picfit
CMD ./bin/picfit -c /etc/picfit/config.json

I did see you have a Dockerfile and make step, and perhaps I'm just not using it correctly, but when I tried to create a docker image with make docker-build I got the following error:

-> Creating statically linked binary...
mkdir -p /go/src/github.com/thoas/picfit/bin
CGO_ENABLED=0 godep go build -a -installsuffix cgo -o /go/src/github.com/thoas/picfit/bin/ulule-api
application/application.go:6:2: cannot find package "github.com/Sirupsen/logrus" in any of:
    /usr/local/go/src/github.com/Sirupsen/logrus (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/Sirupsen/logrus (from $GOPATH)
    /go/src/github.com/Sirupsen/logrus
main.go:5:2: cannot find package "github.com/codegangsta/cli" in any of:
    /usr/local/go/src/github.com/codegangsta/cli (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/codegangsta/cli (from $GOPATH)
    /go/src/github.com/codegangsta/cli
application/application.go:7:2: cannot find package "github.com/codegangsta/negroni" in any of:
    /usr/local/go/src/github.com/codegangsta/negroni (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/codegangsta/negroni (from $GOPATH)
    /go/src/github.com/codegangsta/negroni
engines/constants.go:4:2: cannot find package "github.com/disintegration/imaging" in any of:
    /usr/local/go/src/github.com/disintegration/imaging (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/disintegration/imaging (from $GOPATH)
    /go/src/github.com/disintegration/imaging
application/server.go:5:2: cannot find package "github.com/facebookgo/grace/gracehttp" in any of:
    /usr/local/go/src/github.com/facebookgo/grace/gracehttp (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/facebookgo/grace/gracehttp (from $GOPATH)
    /go/src/github.com/facebookgo/grace/gracehttp
http/http.go:5:2: cannot find package "github.com/franela/goreq" in any of:
    /usr/local/go/src/github.com/franela/goreq (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/franela/goreq (from $GOPATH)
    /go/src/github.com/franela/goreq
application/application.go:8:2: cannot find package "github.com/getsentry/raven-go" in any of:
    /usr/local/go/src/github.com/getsentry/raven-go (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/getsentry/raven-go (from $GOPATH)
    /go/src/github.com/getsentry/raven-go
application/application.go:9:2: cannot find package "github.com/gorilla/mux" in any of:
    /usr/local/go/src/github.com/gorilla/mux (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/gorilla/mux (from $GOPATH)
    /go/src/github.com/gorilla/mux
engines/goimage.go:17:2: cannot find package "github.com/imdario/mergo" in any of:
    /usr/local/go/src/github.com/imdario/mergo (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/imdario/mergo (from $GOPATH)
    /go/src/github.com/imdario/mergo
application/application.go:10:2: cannot find package "github.com/jmoiron/jsonq" in any of:
    /usr/local/go/src/github.com/jmoiron/jsonq (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/jmoiron/jsonq (from $GOPATH)
    /go/src/github.com/jmoiron/jsonq
application/application.go:11:2: cannot find package "github.com/meatballhat/negroni-logrus" in any of:
    /usr/local/go/src/github.com/meatballhat/negroni-logrus (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/meatballhat/negroni-logrus (from $GOPATH)
    /go/src/github.com/meatballhat/negroni-logrus
application/forms.go:5:2: cannot find package "github.com/mholt/binding" in any of:
    /usr/local/go/src/github.com/mholt/binding (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/mholt/binding (from $GOPATH)
    /go/src/github.com/mholt/binding
application/parameters.go:5:2: cannot find package "github.com/mitchellh/goamz/aws" in any of:
    /usr/local/go/src/github.com/mitchellh/goamz/aws (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/mitchellh/goamz/aws (from $GOPATH)
    /go/src/github.com/mitchellh/goamz/aws
application/application.go:12:2: cannot find package "github.com/rs/cors" in any of:
    /usr/local/go/src/github.com/rs/cors (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/rs/cors (from $GOPATH)
    /go/src/github.com/rs/cors
application/application.go:13:2: cannot find package "github.com/thoas/gokvstores" in any of:
    /usr/local/go/src/github.com/thoas/gokvstores (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/thoas/gokvstores (from $GOPATH)
    /go/src/github.com/thoas/gokvstores
application/application.go:14:2: cannot find package "github.com/thoas/gostorages" in any of:
    /usr/local/go/src/github.com/thoas/gostorages (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/thoas/gostorages (from $GOPATH)
    /go/src/github.com/thoas/gostorages
application/application.go:19:2: cannot find package "github.com/thoas/stats" in any of:
    /usr/local/go/src/github.com/thoas/stats (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/github.com/thoas/stats (from $GOPATH)
    /go/src/github.com/thoas/stats
engines/goimage.go:19:2: cannot find package "golang.org/x/image/bmp" in any of:
    /usr/local/go/src/golang.org/x/image/bmp (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/golang.org/x/image/bmp (from $GOPATH)
    /go/src/golang.org/x/image/bmp
engines/goimage.go:20:2: cannot find package "golang.org/x/image/tiff" in any of:
    /usr/local/go/src/golang.org/x/image/tiff (from $GOROOT)
    /go/src/github.com/thoas/picfit/Godeps/_workspace/src/golang.org/x/image/tiff (from $GOPATH)
    /go/src/golang.org/x/image/tiff
godep: go exit status 1
Makefile:30: recipe for target 'build-static' failed
make: *** [build-static] Error 1
Makefile:38: recipe for target 'docker-build' failed
make: *** [docker-build] Error 2

Some instructions for using that would be useful, but otherwise you've got good documentation!

thoas commented 8 years ago

Thank you for the report, I will vendorize dependencies.

thoas commented 8 years ago

@steevee dependencies has been vendorized in the master HEAD, you should checkout this version.

make docker-build has been also updated as follows.

steevee commented 8 years ago

@thoas nicw, thanks! I'm still getting deps issues when running make docker-build:

...
-> Creating statically linked binary...
mkdir -p /go/src/github.com/thoas/picfit/bin
application/server.go:5:2: cannot find package "github.com/facebookgo/grace/gracehttp" in any of:
    /go/src/github.com/thoas/picfit/vendor/github.com/facebookgo/grace/gracehttp (vendor tree)
    /usr/local/go/src/github.com/facebookgo/grace/gracehttp (from $GOROOT)
    /go/src/github.com/facebookgo/grace/gracehttp (from $GOPATH)
application/parameters.go:5:2: cannot find package "github.com/mitchellh/goamz/aws" in any of:
    /go/src/github.com/thoas/picfit/vendor/github.com/mitchellh/goamz/aws (vendor tree)
    /usr/local/go/src/github.com/mitchellh/goamz/aws (from $GOROOT)
    /go/src/github.com/mitchellh/goamz/aws (from $GOPATH)
application/application.go:6:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/Sirupsen/logrus
main.go:5:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/codegangsta/cli
application/application.go:7:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/codegangsta/negroni
engines/constants.go:4:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/disintegration/imaging
http/http.go:5:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/franela/goreq
application/application.go:8:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/getsentry/raven-go
application/application.go:9:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/gorilla/mux
engines/goimage.go:17:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/imdario/mergo
application/application.go:10:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/jmoiron/jsonq
application/application.go:11:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/meatballhat/negroni-logrus
application/forms.go:5:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/mholt/binding
application/application.go:12:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/rs/cors
application/application.go:13:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/thoas/gokvstores
application/application.go:14:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/thoas/gostorages
application/application.go:19:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/thoas/stats
engines/goimage.go:19:2: cannot find package "golang.org/x/image/bmp" in any of:
    /go/src/github.com/thoas/picfit/vendor/golang.org/x/image/bmp (vendor tree)
    /usr/local/go/src/golang.org/x/image/bmp (from $GOROOT)
    /go/src/golang.org/x/image/bmp (from $GOPATH)
engines/goimage.go:20:2: cannot find package "golang.org/x/image/tiff" in any of:
    /go/src/github.com/thoas/picfit/vendor/golang.org/x/image/tiff (vendor tree)
    /usr/local/go/src/golang.org/x/image/tiff (from $GOROOT)
    /go/src/golang.org/x/image/tiff (from $GOPATH)
Makefile:26: recipe for target 'build-static' failed
make: *** [build-static] Error 1
make: *** [docker-build] Error 2

Sorry, I'm very new to godeps, am I missing a trick?

thoas commented 8 years ago

Should be fixed in the HEAD

steevee commented 8 years ago

@thoas I'm even newer to glide :smile: and I'm still getting the same error.

Should there be a glide up or similar step to pull in dependencies?

thoas commented 8 years ago

@steevee you only need to retrieve the current HEAD with my latest fix and run make docker-build.

You don't need to use glide or whatever as all dependencies are stored in the vendor/ directory so you already have the dependencies.

Could you paste me the full version of the error?

steevee commented 8 years ago

@thoas OK, I can confirm I'm on current HEAD (e56de8b24e2aeca34e148f3e4b3af19d1183af56) and still getting the issue, here in full:

~/picfit> sudo make docker-build
-> Preparing builder...
Sending build context to Docker daemon 7.318 MB
Step 1 : FROM golang:1.5.2
 ---> 7d900f734f50
Step 2 : ENV GO15VENDOREXPERIMENT 1
 ---> Using cache
 ---> eb1265965344
Step 3 : ADD . /go/src/github.com/thoas/picfit
 ---> Using cache
 ---> e7d8cd00419a
Step 4 : WORKDIR /go/src/github.com/thoas/picfit
 ---> Using cache
 ---> 8ef1d43f2eea
Step 5 : VOLUME /go/src/github.com/thoas/picfit/bin
 ---> Using cache
 ---> f37a12351471
Step 6 : CMD make build-static
 ---> Using cache
 ---> e9bfce1b08ec
Successfully built e9bfce1b08ec
-> Creating statically linked binary...
mkdir -p /go/src/github.com/thoas/picfit/bin
application/server.go:5:2: cannot find package "github.com/facebookgo/grace/gracehttp" in any of:
    /go/src/github.com/thoas/picfit/vendor/github.com/facebookgo/grace/gracehttp (vendor tree)
    /usr/local/go/src/github.com/facebookgo/grace/gracehttp (from $GOROOT)
    /go/src/github.com/facebookgo/grace/gracehttp (from $GOPATH)
application/parameters.go:5:2: cannot find package "github.com/mitchellh/goamz/aws" in any of:
    /go/src/github.com/thoas/picfit/vendor/github.com/mitchellh/goamz/aws (vendor tree)
    /usr/local/go/src/github.com/mitchellh/goamz/aws (from $GOROOT)
    /go/src/github.com/mitchellh/goamz/aws (from $GOPATH)
application/application.go:6:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/Sirupsen/logrus
main.go:5:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/codegangsta/cli
application/application.go:7:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/codegangsta/negroni
engines/constants.go:4:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/disintegration/imaging
http/http.go:5:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/franela/goreq
application/application.go:8:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/getsentry/raven-go
application/application.go:9:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/gorilla/mux
engines/goimage.go:17:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/imdario/mergo
application/application.go:10:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/jmoiron/jsonq
application/application.go:11:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/meatballhat/negroni-logrus
application/forms.go:5:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/mholt/binding
application/application.go:12:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/rs/cors
application/application.go:13:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/thoas/gokvstores
application/application.go:14:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/thoas/gostorages
application/application.go:19:2: no buildable Go source files in /go/src/github.com/thoas/picfit/vendor/github.com/thoas/stats
engines/goimage.go:19:2: cannot find package "golang.org/x/image/bmp" in any of:
    /go/src/github.com/thoas/picfit/vendor/golang.org/x/image/bmp (vendor tree)
    /usr/local/go/src/golang.org/x/image/bmp (from $GOROOT)
    /go/src/golang.org/x/image/bmp (from $GOPATH)
engines/goimage.go:20:2: cannot find package "golang.org/x/image/tiff" in any of:
    /go/src/github.com/thoas/picfit/vendor/golang.org/x/image/tiff (vendor tree)
    /usr/local/go/src/golang.org/x/image/tiff (from $GOROOT)
    /go/src/golang.org/x/image/tiff (from $GOPATH)
Makefile:27: recipe for target 'build-static' failed
make: *** [build-static] Error 1
make: *** [docker-build] Error 2

Running Docker client/server 1.9.1

thoas commented 8 years ago

Should be fixed by now, git ignored the vendor directory.

steevee commented 8 years ago

That's the one! Thanks a bunch for your help!