提交 221652fc 作者: Łukasz Magiera

fix govet warnings

License: MIT
Signed-off-by: 's avatarŁukasz Magiera <magik6k@gmail.com>
上级 e77033cb
...@@ -173,7 +173,7 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error { ...@@ -173,7 +173,7 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
// hash security // hash security
bs := bstore.NewBlockstore(rds) bs := bstore.NewBlockstore(rds)
bs = &verifbs.VerifBS{bs} bs = &verifbs.VerifBS{Blockstore: bs}
opts := bstore.DefaultCacheOpts() opts := bstore.DefaultCacheOpts()
conf, err := n.Repo.Config() conf, err := n.Repo.Config()
...@@ -202,7 +202,7 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error { ...@@ -202,7 +202,7 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
// hash security // hash security
n.Filestore = filestore.NewFilestore(bs, n.Repo.FileManager()) n.Filestore = filestore.NewFilestore(bs, n.Repo.FileManager())
n.Blockstore = bstore.NewGCBlockstore(n.Filestore, n.GCLocker) n.Blockstore = bstore.NewGCBlockstore(n.Filestore, n.GCLocker)
n.Blockstore = &verifbs.VerifBSGC{n.Blockstore} n.Blockstore = &verifbs.VerifBSGC{GCBlockstore: n.Blockstore}
} }
rcfg, err := n.Repo.Config() rcfg, err := n.Repo.Config()
......
...@@ -77,7 +77,7 @@ func (f *FileManager) AllKeysChan(ctx context.Context) (<-chan *cid.Cid, error) ...@@ -77,7 +77,7 @@ func (f *FileManager) AllKeysChan(ctx context.Context) (<-chan *cid.Cid, error)
k := ds.RawKey(v.Key) k := ds.RawKey(v.Key)
c, err := dshelp.DsKeyToCid(k) c, err := dshelp.DsKeyToCid(k)
if err != nil { if err != nil {
log.Error("decoding cid from filestore: %s", err) log.Errorf("decoding cid from filestore: %s", err)
continue continue
} }
......
...@@ -619,7 +619,6 @@ func (r *FSRepo) SetConfigKey(key string, value interface{}) error { ...@@ -619,7 +619,6 @@ func (r *FSRepo) SetConfigKey(key string, value interface{}) error {
case string: case string:
value, ok = value.(string) value, ok = value.(string)
default: default:
value = value
} }
if !ok { if !ok {
return fmt.Errorf("Wrong config type, expected %T", oldValue) return fmt.Errorf("Wrong config type, expected %T", oldValue)
......
...@@ -21,7 +21,8 @@ func main() { ...@@ -21,7 +21,8 @@ func main() {
fmt.Fprintf(os.Stderr, "Error: %v\n", err) fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1) os.Exit(1)
} }
ctx, _ := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Second) ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Second)
defer cancel()
cmd := exec.CommandContext(ctx, os.Args[2], os.Args[3:]...) cmd := exec.CommandContext(ctx, os.Args[2], os.Args[3:]...)
cmd.Stdin = os.Stdin cmd.Stdin = os.Stdin
......
...@@ -40,8 +40,8 @@ type Notifier struct { ...@@ -40,8 +40,8 @@ type Notifier struct {
// RateLimited returns a rate limited Notifier. only limit goroutines // RateLimited returns a rate limited Notifier. only limit goroutines
// will be spawned. If limit is zero, no rate limiting happens. This // will be spawned. If limit is zero, no rate limiting happens. This
// is the same as `Notifier{}`. // is the same as `Notifier{}`.
func RateLimited(limit int) Notifier { func RateLimited(limit int) *Notifier {
n := Notifier{} n := &Notifier{}
if limit > 0 { if limit > 0 {
n.lim = ratelimit.NewRateLimiter(process.Background(), limit) n.lim = ratelimit.NewRateLimiter(process.Background(), limit)
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论