mrserverless / serverless-golang

AWS Lambda Go functions using Serverless Framework and Python shim
Other
302 stars 21 forks source link

`make dockerDist deploy` errors unable to find package #9

Closed digitalfiz closed 7 years ago

digitalfiz commented 7 years ago
✘-2 ~/Projects/personal/my-sls-golang-net
13:07 $ make deps
latest: Pulling from eawsy/aws-lambda-go-shim
Digest: sha256:a405f212c35de3ec61b75f3da2f9c3c2a9a5c999fa1a072b2df86aa393da57db
Status: Image is up to date for eawsy/aws-lambda-go-shim:latest
✔ ~/Projects/personal/my-sls-golang-net
13:07 $ make dockerDist deploy
docker run --rm -ti -e HANDLER=handler -e PACKAGE=handler -v /Users/mseiler/.go/:/go -v /Users/mseiler/Projects/personal/my-sls-golang-net:/tmp -w /tmp eawsy/aws-lambda-go-shim:latest  make dist
handler.go:9:2: cannot find package "github.com/eawsy/aws-lambda-go-net/service/lambda/runtime/net" in any of:
    /usr/local/go/src/github.com/eawsy/aws-lambda-go-net/service/lambda/runtime/net (from $GOROOT)
    /go/src/github.com/eawsy/aws-lambda-go-net/service/lambda/runtime/net (from $GOPATH)
handler.go:4:2: cannot find package "github.com/eawsy/aws-lambda-go-net/service/lambda/runtime/net/apigatewayproxy" in any of:
    /usr/local/go/src/github.com/eawsy/aws-lambda-go-net/service/lambda/runtime/net/apigatewayproxy (from $GOROOT)
    /go/src/github.com/eawsy/aws-lambda-go-net/service/lambda/runtime/net/apigatewayproxy (from $GOPATH)
handler.go:6: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/gorilla/mux (from $GOPATH)
make: *** [build] Error 1
make: *** [dockerDist] Error 2
mrserverless commented 7 years ago

Thanks for pointing this out @digitalfiz

I think this can be resolved if you run go get first in your project. It should be included as part of the make deps. I will update the sample project and makefile accordingly.

digitalfiz commented 7 years ago

when I run go get I get this error next:

go install: no install location for directory /Users/mseiler/Projects/personal/my-sls-golang-net outside GOPATH
    For more details see: 'go help gopath'

Do I need to set my GOPATH to anything specific?

mrserverless commented 7 years ago

Your project needs to reside within your $GOPATH/src as per standard golang projects. See https://github.com/golang/go/wiki/GOPATH

mrserverless commented 7 years ago

I've added the $GOPATH to README instructions and also included go get -u -d in make deps. Closing this for now. Let me know if you have further issues