I am new to Go, and I have been working on a Go project locally. I have installed Godep in my local system by:
go get github.com/tools/godep
and then installed Aerospike dependency
go get -u github.com/aerospike/aerospike-client-go
However $GOPATH/bin/godep save ./... gives me following error:-
godep: [WARNING]: godep should only be used inside a valid go package directory and
godep: [WARNING]: may not function correctly. You are probably outside of your $GOPATH.
godep: [WARNING]: Current Directory: /Users/XYZ/go_code/labs-audience
godep: [WARNING]: $GOPATH: /Users/XYZ/go_code
godep: WARNING: Godep workspaces (./Godeps/_workspace) are deprecated and support for them will be removed when go1.8 is released.
godep: WARNING: Go version (go1.6) & $GO15VENDOREXPERIMENT= wants to enable the vendor experiment, but disabling because a Godep workspace (Godeps/_workspace) exists
godep: WARNING: Recorded major go version (go1.5) and in-use major go version (go1.6) differ.
godep: To record current major go version run `godep update -goversion`.
It truncates my Godeps/Godeps.json and Godeps/_workspace/ directory. Please not that I am not panning to upgrade project Go version to 1.6. What wrong am I doing?
Note:
$PROJECT_PATH: $GOPATH/project/
All the commands are being run in $PROJECT_PATH
I am missing the src directory. $GOPATH directory has a certain structure and your projects folder should be located in the src directory.
Can't confirm that this is causing your issue, but it is worth a try: Move your folder labs-audience to /Users/XYZ/go_code/src/labs-audience.
For more information on setting your project up check the Code Organization part on How to Write Go Code.
Note: to keep package paths distinct it is suggested to use a public path for your project. Normally a github (or other vcs path) is used. For example: /Users/XYZ/go_code/src/github.com/YourAccount/labs-audience
Related
I need to update stripe-go library version.
Project has 19.**
New version 52.**
There is a godeps dependency manager
When I try to run
godep save github.com/stripe/stripe-go
I get
godep: cannot save github.com/stripe/stripe-go/form at revision
f8b095462d541c43d981d28de52b7464b25f3ee1: already have
github.com/stripe/stripe-go at revision
87c04229ff0262e4e7dfc8af7dc97a471e955ba2.
Run `godep update github.com/stripe/stripe-go' first.
And when I run
godep update github.com/stripe/stripe-go
I get
godep: no packages can be updated
What do I do wrong?
I remember this issue, quoting from https://github.com/tools/godep/issues/164#issuecomment-101345584
This seems to be caused by this line here:
https://github.com/tools/godep/blob/master/update.go#L205
If packages A and B are under the same root, and I try to only update
B, the root will be marked for skipping update because A isn't being
updated. I'm not sure what the motivation for this feature is, it
seems that developers should be able to selectively update sub
packages as they desire.
For what it's worth, I fixed my problem by globbing from the root in
my godep update command (e.g. godep update github.com/foo/bar/...
instead of github.com/foo/bar/pkg/B. A helpful error message would
have gone a long way
While you're here, go 1.11 and above has inbuilt module support. Maybe look into shifting into that? https://github.com/golang/go/wiki/Modules
When I run godep save ./... from the root directory of the project I'm getting the following error. Any clues what might I have to fix?
godep: Unable to find SrcRoot for package .
Filesystem location matters a lot in Go. You’re expected to be running things from a designated ‘gopath’, but don’t confuse gopath with the location of go (don’t just set it to where go is installed).
Your gopath should be a location that you’re happy to put your go source code for the foreseeable future. I’ve set mine to /Users/ejiro/go.
cat <<END >> ~/.bashrc
export GOPATH=/Users/ejiro/go
END
When trying to run godep save, I'm always getting the following error:
godep: [WARNING]: godep should only be used inside a valid go package directory and
godep: [WARNING]: may not function correctly. You are probably outside of your $GOPATH.
godep: [WARNING]: Current Directory: /Users/username/Development/my-server
godep: [WARNING]: $GOPATH: /Users/username/Development/my-server
Does anyone know how to solve this issue?
You want to make sure that you run this command from a repo that is also defined in your $GOPATH.
So it would need to be: /Users/username/gosource/src/github/foo/my-server/
This means that not only are all your packages located in your $GOPATH but additionally your own repo is located in your $GOPATH. At this point everything should work as expected.
If you don't have a $GOPATH environment variable defined you need to make sure it is set pre Go1.8.
Try this: echo $GOPATH at the command prompt to see if it's defined.
If not, you'll want to choose a location and set it with: export GOPATH=/your/final/location.
More details can be found here.
Im pretty new to Go but not to software. Im working on a new team with lots of projects and dependencies so we must use godep.
All the code is structure in the standard Go way, with files in $GOPATH/.../github.com/... etc (including our work which is in github)
I made changes to project A (github.com/ourTeam/A) and I want to run project B (github.com/ourTeam/B) which references A to test my code.
so I commit my work from A in my own branch in A, (and even pushed the branch).
-> All I want is to update B with my new version of A.
From B, I tried:
godep update github.com/A/subpackage. It said 'godep: no packages can be updated'
godep save. It deleted EVERYTHING in the vendor folder, leaving the Godeps.json file empty from any dependencies
manually updating Godeps.json with my commit, then running godep update.
No message but it didnt update anything. Godep save after this change deleted everything too in the vendor folder and Godep.json
What am I missing ?
Note: Im using godep v65 (darwin/amd64/go1.6.2) and godep save -v said
godep: Finding dependencies for [.]
godep: Found package: github.com/ourTeam/B
godep: Deps:
(nothing so the diff with old file removes everything)
The error message when you tried to update tells me that the dependency on A had not been godep-saved before in B. That would mean you need to save it, instead of updating.
Today, I was having the same problem as you using godep save. All dependencies were being removed. However, this got me through it:
$ go get -u github.com/tools/godep # Make sure you have the latest godep (currently v71)
$ godep save ./... # Literally, "./..." is the argument
# The above command may fail with "Package not found ..."
# Install any package not found with "go get some/package/path"
$ go get some/package/path # if necessary
# Try "godep save ./..." again; repeat "go get" for any "not found" errors.
Once godep save returned without errors, I checked and it had done as expected. It only added the new dependency I had imported in the code.
Hi I am trying to understand as how to update the aws-sdk-go dependencies for terraform. To do this i have configured the
GOPATH as per instruction given below.
http://www.wadewegner.com/2014/12/easy-go-programming-setup-for-windows/
I have installed and configured "godep" in $path.
So now i am able to run "go" and "godep" from cmd.
as per development terraform section\guideline given at
https://github.com/hashicorp/terraform i have git cloned
it at $GOPATH/src/github.com/hashicorp/terraform
again as per guideline i just want to update aws-sdk-go deps. so i am running
godep update github.com\aws\aws-sdk-go
getting below message on cmd
godep: not in manifest: github.com\aws\aws-sdk-go
godep: Package (github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/autorest) not found
I have also verified that path
D:\Ampush\Projects\GO\src\github.com\hashicorp\terraform\vendor\github.com\Azure\azure-sdk-for-go\Godeps\_workspace\src\github.com\Azure\go-autorest\autorest
exists on my machine.
I am running command from below path
D:\Ampush\Projects\GO\src\github.com\hashicorp\terraform>
Updating this further with more findings
if i run first godep restore -v then it has downloaded many stuffs.
then i figured out that my command was wrong now i updated it to
godep update github.com/aws/aws-sdk-go/aws //hint saw in Godep.json
Now i am getting
godep: no packages can be updated
i guess that somewhere i have to mention as to which version i should update default i was assuming it will take latest from the master.
Could you please let me know if i am missing something. Thanks
godep update will update the vendored version from your global gopath version. To get the latest version in your gopath run something like go get -u github.com/aws/aws-sdk-go then you can run your godep update