0

I'm trying to run the application (written in Go) inside docker. To install dependencies I'm using godep. When executing godep inside docker, following error is received

 docker run -ti --rm -v $PWD:/go/src/app -p3000:3000 golang bash 
 root@7c491d184712:/go/src/app# go get github.com/tools/godep 
 root@7c491d184712:/go/src/reno# godep save 
 godep: Package (github.com/Shopify/sarama) not found
Sheshank Kodam
  • 515
  • 5
  • 17

1 Answers1

0

Godep needs you to have local copies of the dependencies you want to vendor. You should run go get before running godep save. Additionally, assuming you have sub-packages in your app folder, you should run godep save ./....

Godep's readme: https://github.com/tools/godep#how-to-use-godep-with-a-new-project

yazgazan
  • 368
  • 1
  • 10
  • Ok. How to handle the dependencies in production? – Sheshank Kodam Jul 18 '17 at 21:29
  • There are two ways to handle dependencies in production. Option 1 is to commit the `vendor` in your repo, this way you can `go build` on your production systems without worrying about dependencies. Option 2 is to omit the `vendor` directory, and use `godep restore` to installed the vendored packages. Not that option 2 won't work if you have dependencies in private repositories. – yazgazan Jul 19 '17 at 07:47