Home > Software design >  How to update the binary by go install?
How to update the binary by go install?

Time:08-02

I used to be able to install a go binary package by:

go get -u github.com/some_user/some_project

Now it does work any more, and after some googling, I learned an alternative:

go install github.com/some_user/some_project@latest

So far so good, but now I pushed a change to the master branch, and I was expecting to run the same go install command again to update the binary file installed, but it didn't. I wonder what the equivalent of go get -u will be with go install.

CodePudding user response:

Actually it's not because of github delay. Github is a git repository, once you push your changes, your code repository gets updated immediately. It's because of goproxy. Goproxy is a centralized repository for go packages, and that's there to avoid (as much as possible) some problems with manually version updating to the code repository and many other reasons, which I'm not going to get deep into, read more here. goproxy wont index every code repository in real time, so that's why you couldn't see your changes. Indeed, you can tell go to not to use the go proxy, and use the github directly:

GOPROXY=direct go get -u github.com/some/package

The direct here means to use the github here directly, it can be any other repository.

CodePudding user response:

It looks like it's a github delay, after some time, running go install again worked.

  •  Tags:  
  • go
  • Related