I trying to deploy my server on heroku and I stuck on step where I should use godep, I spent little time with GO, last two days I had looking how to solve this issue, actually it's a popular issue, but I can't figure out, maybe I did something fundamentally wrong.
I have OS X 10.11.2
My GOPATH - Users/denis/Programming/Golang
My PATH - $GOPATH/bin
I trying to use godep to my project which is placed in $GOPATH/src/backend
in my PATH I have an executable godep file(not .go).
Whole structure of my workplace.
/Golang/
.bin/
godep //executable file
.pkg/
.darwin-amd64/
.//other folders/
.src/
.github.com/
.backend/
.//other folders//
First, what is the output of this:
$ echo $PATH
It should, at a minimal to run Go projects, have TWO directories in it for:
/usr/local/go/bin
)/Users/denis/Programming/Golang/bin
)Your go's installation should be in your PATH already if you followed the Go installation setup.
https://golang.org/doc/install
Since you posted /Users/denis/Programming/Golang
, with the capital U
, I am going to assume that you are on OS X going forward...
In OS X, and if you used the default install, you can test for Go in your PATH with a simple command:
$ echo $PATH | grep --color=auto "/usr/local/go/bin"
It should print our your entire $PATH
and highlight that you have things setup properly. This is because the OS X GoLang installer in the URL above should have modified your PATH to include:
/usr/local/go/bin
export PATH="$PATH:/usr/local/go/bin"
If you have some custom .bashrc
and/or .profile
files, then most likely your PATH isn't being setup correctly. You can test this by doing this:
$ export PATH="$PATH:/usr/local/go/bin"
$ export PATH="$PATH:/Users/denis/Programming/Golang/bin"
$ godep go build
If it works now, then your PATH isn't setup properly in your .bashrc/.profile files. That's a different kind of question and can be setup a 1000 different ways and you may need to figure it out (or another SO question).
If that resolves your issue, then you need to follow the godep
directions to run godep
from your project's root:
$ cd $GOPATH/src/backend/
$ godep save
$ git add Godeps/
godep
creates a Godeps
directory in the root of the Go project. If you have multiple Go projects/multiple executables, then you need to run godep save
on each root of the runtime.
IOW, for each executable you run go build
for, you need to run godep save
in each directory.
Also, once you move to godep
, you want to use it for your build and testing as well:
$ godep go build
$ godep go test
...etc
If that's not the problem (you are running it as stated above), then please update your question with more specifics such as what godep
command you are running, where, and what that directorys structure looks like for the root of that project (including the filename with package main
and your func main()
function).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With