12
回答
glide mirror不生效
终于搞明白,存储TCO原来是这样算的>>>   

@梦朝思夕 你好,想跟你请教个问题:

我现在在使用一份开源代码。这份代码也是用glide管理的。它依赖golang.org/x/crypto。我按照你的帖子做了mirror。

[INFO] --> golang.org/x/crypto replaced by /data/go/src/github.com/golang.org/x/crypto

但我 glide up时,依然有

[WARN] Unable to checkout golang.org/x/crypto

[ERROR] Update failed for golang.org/x/crypto: Cannot detect VCS

能否指导一下?非常感谢!

下图是过程:

web@huanan :/data/go/src/github.com/decred/dcrstakepool$ glide up

[INFO]    Loading mirrors from mirrors.yaml file

[INFO]    Downloading dependencies. Please wait...

INFO]    --> Fetching updates for github.com/haisum/recaptcha

[INFO]    --> Fetching updates for github.com/zenazn/goji

[INFO]    --> Fetching golang.org/x/crypto

[INFO]    --> Fetching golang.org/x/net

[INFO]    --> Fetching google.golang.org/grpc

[INFO]    --> Fetching updates for github.com/jrick/logrotate

[WARN]    Unable to checkout golang.org/x/net

[ERROR]    Update failed for golang.org/x/net: Cannot detect VCS

[WARN]    Unable to checkout golang.org/x/crypto

[ERROR]    Update failed for golang.org/x/crypto: Cannot detect VCS

[WARN]    Unable to checkout google.golang.org/grpc

[ERROR]    Update failed for google.golang.org/grpc: Cannot detect VCS

[ERROR]    Failed to do initial checkout of config: Cannot detect VCS

Cannot detect VCS

Cannot detect VCS

bwweb@huanan :/data/go/src/github.com/decred/dcrstakepool$ glide mirror list

[INFO]    Mirrors...

[INFO]    --> golang.org/x/crypto replaced by /data/go/src/github.com/golang.org/x/crypto

[INFO]    --> golang.org/x/net replaced by /data/go/src/github.com/golang.org/x/net

[INFO]    --> golang.org/x/text replaced by github.com/golang/text

[INFO]    --> google.golang.org/grpc replaced by /data/go/src/github.com/google.golang.org/grpc

bwweb@huanan :/data/go/src/github.com/decred/dcrstakepool$ ls /data/go/src/github.com/golang.org/x/crypto

acme     blake2s   chacha20poly1305  cryptobyte  LICENSE  openpgp  pkcs12     salsa20  tea

AUTHORS  blowfish  codereview.cfg    curve25519  md4      otr      poly1305   scrypt   twofish

bcrypt   bn256     CONTRIBUTING.md   ed25519     nacl     PATENTS  README.md  sha3     xtea

blake2b  cast5     CONTRIBUTORS      hkdf        ocsp     pbkdf2   ripemd160  ssh      xts

<无标签>
举报
puddingS
发帖于2周前 12回/79阅
共有12个答案 最后回答: 2周前

你的贴的日志不是很多,但是可以看到

```

[WARN] Unable to checkout golang.org/x/crypto

[ERROR] Update failed for golang.org/x/crypto: Cannot detect VCS

```

说明使用glide没有获取到`golang.org/x/crypto`,此时需要看看你是否设置了`glide mirror set golang.org/x/crypto github.com/golang/crypto`。

如果你拍着胸脯说已经设置了,那我建议你到`$HOME/.glide`目录下看看`mirrors.yaml`是否存在

```

repos:
- original: golang.org/x/crypto
  repo: github.com/golang/crypto

```  

如果不存在就按照教程再来一次

bwweb@huanan:/data/go/src/github.com/decred/dcrstakepool$ cat ~/.glide/mirrors.yaml 
repos:
- original: golang.org/x/crypto
  repo: /data/go/src/github.com/golang.org/x/crypto
- original: golang.org/x/net
  repo: /data/go/src/github.com/golang.org/x/net
- original: golang.org/x/text
  repo: github.com/golang/text
- original: google.golang.org/grpc
  repo: /data/go/src/github.com/google.golang.org/grpc

如上所示,我是有设置了的。

bwweb@huanan :/data/go/src/github.com/decred/dcrstakepool$ glide mirror list
[INFO]    Mirrors...
[INFO]    --> golang.org/x/crypto replaced by /data/go/src/github.com/golang.org/x/crypto
[INFO]    --> golang.org/x/net replaced by /data/go/src/github.com/golang.org/x/net
[INFO]    --> golang.org/x/text replaced by github.com/golang/text
[INFO]    --> google.golang.org/grpc replaced by /data/go/src/github.com/google.golang.org/grpc
通过这个也可以看到。我是有设置成功的。但glide up就会失败。

bwweb@huanan :/data/go/src/github.com/decred/dcrstakepool$ cat glide.yaml 

package: github.com/decred/dcrstakepool

import:

- package: github.com/btcsuite/btclog

- package: github.com/btcsuite/go-flags

- package: github.com/davecgh/go-spew

  subpackages:

  - spew

- package: github.com/decred/dcrd

  subpackages:

  - blockchain/stake

  - chaincfg

  - chaincfg/chainhash

  - dcrjson

  - wire

- package: github.com/decred/dcrrpcclient

- package: github.com/decred/dcrutil

  subpackages:

  - hdkeychain

- package: github.com/decred/dcrwallet

  subpackages:

  - wallet/udb

- package: github.com/dgrijalva/jwt-go

- package: github.com/go-gorp/gorp

- package: github.com/go-sql-driver/mysql

- package: github.com/golang/protobuf

  subpackages:

  - proto

- package: github.com/gorilla/context

- package: github.com/gorilla/sessions

- package: github.com/haisum/recaptcha

- package: github.com/zenazn/goji

  subpackages:

  - graceful

  - web

  - web/middleware

- package: golang.org/x/crypto

  subpackages:

  - bcrypt

- package: golang.org/x/net

  subpackages:

  - context

- package: google.golang.org/grpc

  subpackages:

  - codes

  - credentials

  - grpclog

- package: github.com/jrick/logrotate

  subpackages:

  - rotator

 

你先使用

```

import:
- package: golang.com/x/text
  repo: https://github.com/golang/text.git
  vcs: git
- package: github.com/btcsuite/btclog
- package: github.com/btcsuite/go-flags
- package: github.com/davecgh/go-spew
  subpackages:
  - spew
- package: github.com/decred/dcrd
  subpackages:
  - blockchain/stake
  - chaincfg
  - chaincfg/chainhash
  - dcrjson
  - wire
- package: github.com/decred/dcrrpcclient
- package: github.com/decred/dcrutil
  subpackages:
  - hdkeychain
- package: github.com/decred/dcrwallet
  subpackages:
  - wallet/udb
- package: github.com/dgrijalva/jwt-go
- package: github.com/go-gorp/gorp
- package: github.com/go-sql-driver/mysql
- package: github.com/golang/protobuf
  subpackages:
  - proto
- package: github.com/gorilla/context
- package: github.com/gorilla/sessions
- package: github.com/haisum/recaptcha
- package: github.com/zenazn/goji
  subpackages:
  - graceful
  - web
  - web/middleware
- package: golang.org/x/crypto
  repo: https://github.com/golang/crypto.git
  vcs: git
  subpackages:
  - bcrypt
- package: golang.org/x/net
  repo: https://github.com/golang/net.git
  vcs: git
  subpackages:
  - context
- package: github.com/jrick/logrotate
  subpackages:
  - rotator

```

其中:

```

- package: google.golang.org/grpc

```

我不是很清楚是哪一个gitgub的,你就去下载:https://www.golangtc.com/static/download/packages/google.golang.org.grpc.tar.gz

手动放进去吧

 

地址有问题吧

bwweb@huanan :/data/go/src/github.com/decred/dcrstakepool$ glide mirror list

[INFO]    Mirrors...

[INFO]    --> golang.org/x/crypto replaced by /data/go/src/github.com/golang.org/x/crypto

[INFO]    --> golang.org/x/net replaced by /data/go/src/github.com/golang.org/x/net

[INFO]    --> golang.org/x/text replaced by github.com/golang/text

[INFO]    --> google.golang.org/grpc replaced by /data/go/src/github.com/google.golang.org/grpc

“github.com/golang.org/x/crypto”,很显然地址错误, 应该是“github.com/golang/crypto”

是这样的。github.com/golang.org/x/crypto是我git clone下来的。然后我把这个路径改成github.com/golang.org/x/crypto。

顶部