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
Related
I am trying to wrap my head around go modules. This is what I have done so far.
Created a simple module and published it as 0.0.1 on github.
Referenced the above mentioned module in a separate go project and used it.
so far it works fine. Now I update the initial module to 0.0.2 and publish it as a release on github. Now when I try go get <published module> it still seems to fetch the original 0.0.1 version and run it. I also deleted all references to 0.0.1 including in go.mod and go.sum and run go get and it still fetches the original 0.0.1 version instead of 0.0.2.
I also tried publishing a major version 1.0.0 and tried to use it, but its still fetching the older 0.0.1 version. I thought it will automatically fetch the latest version and use that.
My go.mod file also shows the following even for the major version
require github.com/user/module v0.0.0-20210223020204-1b5fb712826f // indirect
I feel there could be something wrong in the way its being published on git. Any help, anyone.
It looks like the comments already highlighted the required steps to take, but to capture the information in an answer, here is the relevant snippet from go help get
The -u flag instructs get to use the network to update the named packages
and their dependencies. By default, get uses the network to check out
missing packages but does not use it to look for updates to existing packages.
Basically, go get will only fetch the versions locked in your go.{mod,sum} files and you need to explicitly ask for updates using one of:
# upgrade to the latest release
go get -u github.com/user/module
# upgrade to a specific version
go get github.com/user/module#2.0.0
# use the `latest` version alias
go get github.com/user/module#latest
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
I have followed the instructions # https://github.com/tools/godep regarding updating a dependency but when I go to build\install using the altered version it has not been updated within Godeps/_workspace/pkg
So I have
go get github.com/golang/glog
godep save
godep go install
and I can see
The modification timestamp in Godeps/_workspace/pkg/linux_amd64/github.com/golang/glog.a
The rev commit value in Godeps/Godeps.json
but now when I want to update I follow the instructions
go get github.com/golang/glog
godep update github.com/golang/glog
godep go install
I observe the following
The Godeps/Godeps.json rev commit has been updated
Godeps/_workspace/src/github.com/golang/ source is updated
But the file timestamp for odeps/_workspace/pkg/linux_amd64/github.com/golang/glog.a is not updated hence we are using the previous version
I believe I should add a .gitignore entry for pkg and bin, which means we would do a clean build on a fresh git clone
I know I could do a rm -r on both the pkg and bin directories before the godep go install command
Is this expected behavior ?
Thanks in advance
Pat
FYI
Since golang v1.4 I can now use the -a flag for the go install command, since it now longer tries to rebuild the standard library, see the v1.4 release notes section on the change to the build -a flag
Obviously this does not apply in pre v1.4 as it will attempt to rebuild the standard library packages
I've installed the Go release version as root.
Go1 removed all exp/ code.
Is there smart method to get exp/* back after Go1?
(I mean how to install in my local GOPATH?)
[My Solution]
# pull from go repository to $HOME/repo/go
cd $HOME/repo
hg clone https://go.googlecode.com/hg/go
# make symbolic link to your GOPATH(eg. $HOME/go)
cd $HOME/go/src
ln -s $HOME/repo/go/src/pkg/exp .
The exp/html library was incomplete which is why it was removed for Go1.
However if you really want to use it then
go get code.google.com/p/go/src/pkg/exp/html
may install it back for you. If you want a slightly more complete html parser then you might checkout http://code.google.com/p/go-html-transform/ as well it has an html5 parser as well as a css selector based scraping and transformation library.
EDIT: Apparently trying to go get the package that way doesn't really work. It appears the only way to install this is to checkout the go source code and then install from source. This is actually a really quick an painless process if you want to go that route.
Building from source is the way to do this. When you do the hg update step though, note that since the exp tree is not tagged go1, that hg update release won't get it for you. Instead hg update weekly will get it, and is probably what you want.
Edit: Weekly releases were discontinued after Go 1, so hg update weekly will access increasingly stale code. A better strategy is hg update tip, then copy the exp directory or directories of interest somewhere and recompile it with whatever Go version you are using, Go 1.0.1, for example.
Note: with go 1.4 (Q4, 2014), the url for that exp package will change (again):
code.google.com/p/go.exp => golang.org/x/exp
That means now:
go get golang.org/x/exp
See "Go 1.4 subrepo renaming".
Regarding the html package, it is in net/html, so this will become (as commented by andybalholm):
go get golang.org/x/net/html
The exp packages have been moved to different repositories now, to make them easier to install. Now you can install the former exp/html with go get "golang.org/x/net/html".
This answer is outdated.
This is covered in the golang wiki:
https://code.google.com/p/go-wiki/wiki/InstallingExp
% cd $GOPATH/src
% hg clone https://code.google.com/p/go go-exp
requesting all changes
adding changesets
adding manifests
adding file changes
added 13323 changesets with 50185 changes to 7251 files (+5 heads)
updating to branch default
3464 files updated, 0 files merged, 0 files removed, 0 files unresolved
% mv go-exp/src/pkg/exp .
% rm -rf go-exp
% go install exp/...
Then, to use it:
import "exp/proxy"
I tried this a few months ago and it worked pretty well. Also, when I ran go install ... I limited it to only the package I was interested in: go install exp/html (if I recall, correctly).