Masterminds / glide

Package Management for Golang
https://glide.sh
Other
8.15k stars 541 forks source link

glide install always slowly when network is unreachable #957

Open Adol1111 opened 6 years ago

Adol1111 commented 6 years ago

golang.org is always unreachable in China. So I add repo like this:

package: GlideTest
import:
- package: golang.org/x/time
  repo: https://github.com/golang/time.git
  subpackages:
  - rate

when I run glide install , it wait for 30 seconds - 1 minutes, then output "[INFO] Downloading dependencies. Please wait..."

Then I remove import golang.org/x/time in glide.yaml. ( just remove in glide.yaml, not glide.lock) When I run glide install, it output immediately.

If golang.org is sub dependencies not in current glide.yaml, run glide install also very quickly

Adol1111 commented 6 years ago

I see, when I run glide install, it calls NormalizeName method to get package name and extra data. If pacakge is special which like golang.org/x/net, it will call https://golang.org/x/net?go-get=1 to get a meta tag with the name go-import. Is it necessary?

jeffzhangme commented 6 years ago

It can be solved temporarily, by setting the mirror and modifying the local hosts configuration.

  1. Set the mirrors glide mirror set https://golang.org/x/net https://github.com/golang/net --vcs git
  2. Add the configuration in the hosts file 0.0.0.0 golang.org