From af177bfde6793218883d099f4f0eb64e14180b32 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 24 Jan 2017 12:39:08 +0100 Subject: [PATCH] Address formatting, mispellings, lint errors from goreportcard License: MIT Signed-off-by: Hector Sanjuan --- README.md | 1 + cluster.go | 4 ++-- consensus.go | 6 +++--- ipfs-cluster-service/main.go | 4 ++-- rest_api.go | 18 +++++++++--------- rpc_api_test.go | 14 +++++++------- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 33fbcbd6..58ebfbf4 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) [![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) [![GoDoc](https://godoc.org/github.com/ipfs/ipfs-cluster?status.svg)](https://godoc.org/github.com/ipfs/ipfs-cluster) +[![Go Report Card](https://goreportcard.com/badge/github.com/ipfs/ipfs-cluster)](https://goreportcard.com/report/github.com/ipfs/ipfs-cluster) [![Build Status](https://travis-ci.org/ipfs/ipfs-cluster.svg?branch=master)](https://travis-ci.org/ipfs/ipfs-cluster) [![Coverage Status](https://coveralls.io/repos/github/ipfs/ipfs-cluster/badge.svg?branch=master)](https://coveralls.io/github/ipfs/ipfs-cluster?branch=master) diff --git a/cluster.go b/cluster.go index 0b11593b..a9919778 100644 --- a/cluster.go +++ b/cluster.go @@ -17,7 +17,7 @@ import ( ) // Cluster is the main IPFS cluster component. It provides -// the go-API for it and orchestrates the componenets that make up the system. +// the go-API for it and orchestrates the components that make up the system. type Cluster struct { ctx context.Context @@ -476,7 +476,7 @@ func (c *Cluster) globalPinInfoSlice(method string) ([]GlobalPinInfo, error) { // Merge any errors for p, msg := range erroredPeers { - for c, _ := range fullMap { + for c := range fullMap { fullMap[c].Status[p] = PinInfo{ CidStr: c, Peer: p, diff --git a/consensus.go b/consensus.go index 15740867..e0e2c32a 100644 --- a/consensus.go +++ b/consensus.go @@ -253,7 +253,7 @@ func (cc *Consensus) Shutdown() error { } if errMsgs != "" { - errMsgs += "Consensus shutdown unsucessful" + errMsgs += "Consensus shutdown unsuccessful" logger.Error(errMsgs) return errors.New(errMsgs) } @@ -311,7 +311,7 @@ func (cc *Consensus) LogPin(c *cid.Cid) error { // This means the op did not make it to the log return err } - logger.Infof("pin commited to global state: %s", c) + logger.Infof("pin committed to global state: %s", c) return nil } @@ -330,7 +330,7 @@ func (cc *Consensus) LogUnpin(c *cid.Cid) error { if err != nil { return err } - logger.Infof("unpin commited to global state: %s", c) + logger.Infof("unpin committed to global state: %s", c) return nil } diff --git a/ipfs-cluster-service/main.go b/ipfs-cluster-service/main.go index a9eb09a1..0b32a77a 100644 --- a/ipfs-cluster-service/main.go +++ b/ipfs-cluster-service/main.go @@ -18,9 +18,9 @@ const programName = `ipfs-cluster-service` // Description provides a short summary of the functionality of this tool var Description = fmt.Sprintf(` -%s runs an IPFS Cluster member (version %s). +%s runs an IPFS Cluster peer (version %s). -A member is a node which participates in the cluster consensus, follows +A peer is a node which participates in the cluster consensus, follows a distributed log of pinning and unpinning operations and manages pinning operations to a configured IPFS daemon. diff --git a/rest_api.go b/rest_api.go index f8170c74..bc999edd 100644 --- a/rest_api.go +++ b/rest_api.go @@ -147,55 +147,55 @@ func NewRESTAPI(cfg *Config) (*RESTAPI, error) { func (api *RESTAPI) routes() []route { return []route{ - route{ + { "Members", "GET", "/members", api.memberListHandler, }, - route{ + { "Pins", "GET", "/pins", api.pinListHandler, }, - route{ + { "Version", "GET", "/version", api.versionHandler, }, - route{ + { "Pin", "POST", "/pins/{hash}", api.pinHandler, }, - route{ + { "Unpin", "DELETE", "/pins/{hash}", api.unpinHandler, }, - route{ + { "Status", "GET", "/status", api.statusHandler, }, - route{ + { "StatusCid", "GET", "/status/{hash}", api.statusCidHandler, }, - route{ + { "Sync", "POST", "/status", api.syncHandler, }, - route{ + { "SyncCid", "POST", "/status/{hash}", diff --git a/rpc_api_test.go b/rpc_api_test.go index 4e96ecc1..c685c244 100644 --- a/rpc_api_test.go +++ b/rpc_api_test.go @@ -58,10 +58,10 @@ func (mock *mockService) Status(in struct{}, out *[]GlobalPinInfo) error { c2, _ := cid.Decode(testCid2) c3, _ := cid.Decode(testCid3) *out = []GlobalPinInfo{ - GlobalPinInfo{ + { Cid: c1, Status: map[peer.ID]PinInfo{ - testPeerID: PinInfo{ + testPeerID: { CidStr: testCid1, Peer: testPeerID, IPFS: Pinned, @@ -69,10 +69,10 @@ func (mock *mockService) Status(in struct{}, out *[]GlobalPinInfo) error { }, }, }, - GlobalPinInfo{ + { Cid: c2, Status: map[peer.ID]PinInfo{ - testPeerID: PinInfo{ + testPeerID: { CidStr: testCid2, Peer: testPeerID, IPFS: Pinning, @@ -80,10 +80,10 @@ func (mock *mockService) Status(in struct{}, out *[]GlobalPinInfo) error { }, }, }, - GlobalPinInfo{ + { Cid: c3, Status: map[peer.ID]PinInfo{ - testPeerID: PinInfo{ + testPeerID: { CidStr: testCid3, Peer: testPeerID, IPFS: PinError, @@ -103,7 +103,7 @@ func (mock *mockService) StatusCid(in *CidArg, out *GlobalPinInfo) error { *out = GlobalPinInfo{ Cid: c1, Status: map[peer.ID]PinInfo{ - testPeerID: PinInfo{ + testPeerID: { CidStr: testCid1, Peer: testPeerID, IPFS: Pinned,