diff --git a/e2e/bitrot_test.go b/e2e/bitrot_test.go index eac51e0b..238a10ca 100644 --- a/e2e/bitrot_test.go +++ b/e2e/bitrot_test.go @@ -133,7 +133,7 @@ func testbitrot(t *testing.T) { //check bitrot status on started volume _, err = client.BitrotScrubStatus(volumeName) - r.Contains(err.Error(), "Bitrot is not enabled") + r.Contains(err.Error(), "bitrot is not enabled") //enable bitrot on volume err = client.BitrotEnable(volumeName) @@ -150,7 +150,7 @@ func testbitrot(t *testing.T) { //check bitrot status _, err = client.BitrotScrubStatus(volumeName) - r.Contains(err.Error(), "Bitrot is not enabled") + r.Contains(err.Error(), "bitrot is not enabled") //stop volume err = client.VolumeStop(volumeName) @@ -170,15 +170,15 @@ func testbitrot(t *testing.T) { //check bitrot status scrubStatus, err = client.BitrotScrubStatus(volumeName) - r.Contains(err.Error(), "Bitrot is not enabled") + r.Contains(err.Error(), "bitrot is not enabled") //disable bitrot on volume err = client.BitrotDisable(volumeName) - r.Contains(err.Error(), "Bitrot is already disabled") + r.Contains(err.Error(), "bitrot is already disabled") //check bitrot status _, err = client.BitrotScrubStatus(volumeName) - r.Contains(err.Error(), "Bitrot is not enabled") + r.Contains(err.Error(), "bitrot is not enabled") //stop volume err = client.VolumeStop(volumeName) diff --git a/glustercli/cmd/georep.go b/glustercli/cmd/georep.go index a35cbbf7..feed3361 100644 --- a/glustercli/cmd/georep.go +++ b/glustercli/cmd/georep.go @@ -158,7 +158,7 @@ func parseRemoteData(data string) (string, string, string, error) { remotehostvol := strings.Split(data, "::") if len(remotehostvol) != 2 { - return "", "", "", errors.New("Invalid Remote Volume details, use @:: format") + return "", "", "", errors.New("invalid Remote Volume details, use @:: format") } remoteuserhost := strings.Split(remotehostvol[0], "@") diff --git a/glustercli/cmd/peer.go b/glustercli/cmd/peer.go index b6f1971f..4d97a974 100644 --- a/glustercli/cmd/peer.go +++ b/glustercli/cmd/peer.go @@ -83,7 +83,7 @@ var peerRemoveCmd = &cobra.Command{ peerID := cmd.Flags().Args()[0] var err error if uuid.Parse(peerID) == nil { - err = errors.New("Failed to parse peerID") + err = errors.New("failed to parse peerID") } if err == nil { err = client.PeerRemove(peerID) diff --git a/glustercli/cmd/utils.go b/glustercli/cmd/utils.go index c5da77c1..660c460c 100644 --- a/glustercli/cmd/utils.go +++ b/glustercli/cmd/utils.go @@ -20,7 +20,7 @@ func formatBoolYesNo(value bool) string { func sizeToMb(value string) (uint64, error) { sizeParts := validSizeFormat.FindStringSubmatch(value) if len(sizeParts) == 0 { - return 0, errors.New("Invalid size format") + return 0, errors.New("invalid size format") } // If Size unit is specified as M/K/G/T, Default Size unit is M diff --git a/glustercli/cmd/volume.go b/glustercli/cmd/volume.go index 38140c91..a081cd92 100644 --- a/glustercli/cmd/volume.go +++ b/glustercli/cmd/volume.go @@ -110,7 +110,7 @@ func bricksAsUUID(bricks []string) ([]api.BrickReq, error) { for _, brick := range bricks { hostBrickData := strings.Split(brick, ":") if len(hostBrickData) != 2 { - return nil, errors.New("Invalid Brick details, use : or :") + return nil, errors.New("invalid Brick details, use : or :") } } @@ -315,7 +315,7 @@ func volumeInfoHandler2(cmd *cobra.Command, isInfo bool) error { } } else { if flagCmdFilterKey != "" || flagCmdFilterValue != "" { - return errors.New("Invalid command. Cannot give filter arguments when providing volname") + return errors.New("invalid command. Cannot give filter arguments when providing volname") } vols, err = client.Volumes(volname) } diff --git a/glusterd2/commands/snapshot/snapshot-activate.go b/glusterd2/commands/snapshot/snapshot-activate.go index 896188c0..94d6b37a 100644 --- a/glusterd2/commands/snapshot/snapshot-activate.go +++ b/glusterd2/commands/snapshot/snapshot-activate.go @@ -37,7 +37,7 @@ func validateSnapActivate(c transaction.TxnCtx) error { switch vol.State == volume.VolStarted { case true: if req.Force == false { - return errors.New("Snapshot already started. Use force to override the behaviour") + return errors.New("snapshot already started. Use force to override the behaviour") } fallthrough case false: diff --git a/glusterd2/commands/snapshot/snapshot-create.go b/glusterd2/commands/snapshot/snapshot-create.go index 422f9f4a..8d8260a6 100644 --- a/glusterd2/commands/snapshot/snapshot-create.go +++ b/glusterd2/commands/snapshot/snapshot-create.go @@ -368,7 +368,7 @@ func validateSnapCreate(c transaction.TxnCtx) error { "Bricks", statusStr, ).Error("Bricks are offline") - return errors.New("One or more brick is offline") + return errors.New("one or more brick is offline") } statusComptability := snapshot.CheckBricksCompatability(volinfo) if statusComptability != nil { @@ -376,7 +376,7 @@ func validateSnapCreate(c transaction.TxnCtx) error { "Bricks", statusStr, ).Error("Bricks are not compatable") - return errors.New("One or more brick is not compatable") + return errors.New("one or more brick is not compatable") } if nodeData, err = populateBrickMountData(volinfo, req.SnapName); err != nil { return err @@ -595,7 +595,7 @@ func validateOriginNodeSnapCreate(c transaction.TxnCtx) error { if volinfo.State != volume.VolStarted { - return errors.New("Volume has not started") + return errors.New("volume has not started") } barrierOp := volinfo.Options["features.barrier"] if err := c.Set("barrier-enabled", &barrierOp); err != nil { diff --git a/glusterd2/commands/snapshot/snapshot-deactivate.go b/glusterd2/commands/snapshot/snapshot-deactivate.go index c7ea4067..d6dda9ac 100644 --- a/glusterd2/commands/snapshot/snapshot-deactivate.go +++ b/glusterd2/commands/snapshot/snapshot-deactivate.go @@ -41,7 +41,7 @@ func validateSnapDeactivate(c transaction.TxnCtx) error { } } case false: - return errors.New("Snapshot is already stopped") + return errors.New("snapshot is already stopped") } if err := c.SetNodeResult(gdctx.MyUUID, "brickListToOperate", &brickinfos); err != nil { diff --git a/glusterd2/commands/volumes/common.go b/glusterd2/commands/volumes/common.go index 56cebc61..12ffa955 100644 --- a/glusterd2/commands/volumes/common.go +++ b/glusterd2/commands/volumes/common.go @@ -108,7 +108,7 @@ func expandGroupOptions(opts map[string]string) (map[string]string, error) { } options[option.Name] = op.DefaultValue default: - return nil, errors.New("Need either on or off") + return nil, errors.New("need either on or off") } } } diff --git a/glusterd2/commands/volumes/volume-create-disperse.go b/glusterd2/commands/volumes/volume-create-disperse.go index e0306216..69c40c80 100644 --- a/glusterd2/commands/volumes/volume-create-disperse.go +++ b/glusterd2/commands/volumes/volume-create-disperse.go @@ -13,7 +13,7 @@ func checkDisperseParams(req *api.SubvolReq, s *volume.Subvol) error { if req.DisperseData > 0 { if req.DisperseCount > 0 && req.DisperseRedundancy > 0 { if req.DisperseCount != req.DisperseData+req.DisperseRedundancy { - return errors.New("Disperse count should be equal to sum of disperse-data and redundancy") + return errors.New("disperse count should be equal to sum of disperse-data and redundancy") } } else if req.DisperseRedundancy > 0 { req.DisperseCount = req.DisperseData + req.DisperseRedundancy @@ -21,7 +21,7 @@ func checkDisperseParams(req *api.SubvolReq, s *volume.Subvol) error { req.DisperseRedundancy = req.DisperseCount - req.DisperseData } else { if count-req.DisperseData >= req.DisperseData { - return errors.New("Need redundancy count along with disperse-data") + return errors.New("need redundancy count along with disperse-data") } req.DisperseRedundancy = count - req.DisperseData req.DisperseCount = count @@ -30,7 +30,7 @@ func checkDisperseParams(req *api.SubvolReq, s *volume.Subvol) error { if req.DisperseCount <= 0 { if count < 3 { - return errors.New("Number of bricks must be greater than 2") + return errors.New("number of bricks must be greater than 2") } req.DisperseCount = count } @@ -40,11 +40,11 @@ func checkDisperseParams(req *api.SubvolReq, s *volume.Subvol) error { } if req.DisperseCount != count { - return errors.New("Disperse count and the number of bricks must be same for a pure disperse volume") + return errors.New("disperse count and the number of bricks must be same for a pure disperse volume") } if 2*req.DisperseRedundancy >= req.DisperseCount { - return errors.New("Invalid redundancy value") + return errors.New("invalid redundancy value") } s.DisperseCount = req.DisperseCount diff --git a/glusterd2/commands/volumes/volume-create-txn.go b/glusterd2/commands/volumes/volume-create-txn.go index e21d1187..0c7c54e1 100644 --- a/glusterd2/commands/volumes/volume-create-txn.go +++ b/glusterd2/commands/volumes/volume-create-txn.go @@ -67,11 +67,11 @@ func populateSubvols(volinfo *volume.Volinfo, req *api.VolCreateReq) error { var err error for idx, subvolreq := range req.Subvols { if subvolreq.ReplicaCount == 0 && subvolreq.Type == "replicate" { - return errors.New("Replica count not specified") + return errors.New("replica count not specified") } if subvolreq.ReplicaCount > 0 && subvolreq.ReplicaCount != len(subvolreq.Bricks) { - return errors.New("Invalid number of bricks") + return errors.New("invalid number of bricks") } name := fmt.Sprintf("%s-%s-%d", volinfo.Name, strings.ToLower(subvolreq.Type), idx) @@ -94,7 +94,7 @@ func populateSubvols(volinfo *volume.Volinfo, req *api.VolCreateReq) error { if subvolreq.ArbiterCount != 0 { if subvolreq.ReplicaCount != 3 || subvolreq.ArbiterCount != 1 { - return errors.New("For arbiter configuration, replica count must be 3 and arbiter count must be 1. The 3rd brick of the replica will be the arbiter") + return errors.New("for arbiter configuration, replica count must be 3 and arbiter count must be 1. The 3rd brick of the replica will be the arbiter") } s.ArbiterCount = 1 } diff --git a/glusterd2/commands/volumes/volume-create.go b/glusterd2/commands/volumes/volume-create.go index 55103ac4..534df1e9 100644 --- a/glusterd2/commands/volumes/volume-create.go +++ b/glusterd2/commands/volumes/volume-create.go @@ -26,7 +26,7 @@ func validateVolCreateReq(req *api.VolCreateReq) error { } if req.Transport != "" && req.Transport != "tcp" && req.Transport != "rdma" { - return errors.New("Invalid transport. Supported values: tcp or rdma") + return errors.New("invalid transport. Supported values: tcp or rdma") } if len(req.Subvols) <= 0 { diff --git a/glusterd2/commands/volumes/volume-expand-txn.go b/glusterd2/commands/volumes/volume-expand-txn.go index 9eecc0c2..ce6b4b1f 100644 --- a/glusterd2/commands/volumes/volume-expand-txn.go +++ b/glusterd2/commands/volumes/volume-expand-txn.go @@ -37,15 +37,15 @@ func expandValidatePrepare(c transaction.TxnCtx) error { newReplicaCount = volinfo.Subvols[0].ReplicaCount } if (len(req.Bricks)+len(volinfo.GetBricks()))%newReplicaCount != 0 { - return errors.New("Invalid number of bricks") + return errors.New("invalid number of bricks") } if volinfo.Type == volume.Replicate && req.ReplicaCount != 0 { // TODO: Only considered first sub volume's ReplicaCount if req.ReplicaCount < volinfo.Subvols[0].ReplicaCount { - return errors.New("Invalid number of bricks") + return errors.New("invalid number of bricks") } else if req.ReplicaCount == volinfo.Subvols[0].ReplicaCount { - return errors.New("Replica count is same") + return errors.New("replica count is same") } } diff --git a/glusterd2/commands/volumes/volume-statedump.go b/glusterd2/commands/volumes/volume-statedump.go index af294241..2010144d 100644 --- a/glusterd2/commands/volumes/volume-statedump.go +++ b/glusterd2/commands/volumes/volume-statedump.go @@ -24,7 +24,7 @@ func validateVolStatedumpReq(req *api.VolStatedumpReq) error { var tmp api.VolStatedumpReq // zero value of struct if *req == tmp { - return errors.New("At least one of the statedump req options must be set") + return errors.New("at least one of the statedump req options must be set") } if req.Client != tmp.Client { diff --git a/glusterd2/servers/sunrpc/dict/dict.go b/glusterd2/servers/sunrpc/dict/dict.go index aba22cf4..e138a66b 100644 --- a/glusterd2/servers/sunrpc/dict/dict.go +++ b/glusterd2/servers/sunrpc/dict/dict.go @@ -40,7 +40,7 @@ func Unserialize(buf []byte) (map[string]string, error) { count := int(binary.BigEndian.Uint32(tmpHeader)) if count < 0 { - return nil, errors.New("Invalid dict count") + return nil, errors.New("invalid dict count") } for i := 0; i < count; i++ { @@ -135,7 +135,7 @@ func Serialize(dict map[string]string) ([]byte, error) { } if dictSerializedSize != totalBytesWritten { - return nil, errors.New("Dict serialized size mismatch") + return nil, errors.New("dict serialized size mismatch") } return buffer.Bytes(), nil @@ -144,7 +144,7 @@ func Serialize(dict map[string]string) ([]byte, error) { func getSerializedDictLen(dict map[string]string) (int, error) { if dict == nil || len(dict) == 0 { - return 0, errors.New("Nil or empty dict") + return 0, errors.New("nil or empty dict") } totalSize := int(dictHeaderLen) // dict count diff --git a/glusterd2/transaction/step.go b/glusterd2/transaction/step.go index 8e6c914b..12a02c2a 100644 --- a/glusterd2/transaction/step.go +++ b/glusterd2/transaction/step.go @@ -29,7 +29,7 @@ type Step struct { var ( // ErrStepFuncNotFound is returned if the stepfunc isn't found. - ErrStepFuncNotFound = errors.New("StepFunc was not found") + ErrStepFuncNotFound = errors.New("stepFunc was not found") ) // do runs the DoFunc on the nodes diff --git a/glusterd2/volgen2/volgen.go b/glusterd2/volgen2/volgen.go index 4a885eee..93c01f1e 100644 --- a/glusterd2/volgen2/volgen.go +++ b/glusterd2/volgen2/volgen.go @@ -99,7 +99,7 @@ func (e *Entry) SetIgnoreOptions(opts []string) *Entry { // Generate generates Volfile content func (v *Volfile) Generate(graph string, extra *map[string]extrainfo) (string, error) { if v.Name == "" || v.FileName == "" { - return "", errors.New("Incomplete details") + return "", errors.New("incomplete details") } return v.RootEntry.Generate(graph, extra) diff --git a/glusterd2/volume/fs_utils.go b/glusterd2/volume/fs_utils.go index 946a9a58..74cbb861 100644 --- a/glusterd2/volume/fs_utils.go +++ b/glusterd2/volume/fs_utils.go @@ -88,7 +88,7 @@ func UsageInfo(volname string) (*SizeInfo, error) { if fstat.Type != fuseSuperMagic { // Do a crude check if mountpoint is a glusterfs mount - return nil, errors.New("Not FUSE mount") + return nil, errors.New("not FUSE mount") } return createSizeInfo(&fstat), nil diff --git a/glusterd2/volume/struct.go b/glusterd2/volume/struct.go index dcb68185..c8f05373 100644 --- a/glusterd2/volume/struct.go +++ b/glusterd2/volume/struct.go @@ -132,7 +132,7 @@ func NewBrickEntries(bricks []api.BrickReq, volName string, volID uuid.UUID) ([] for _, b := range bricks { u := uuid.Parse(b.PeerID) if u == nil { - return nil, errors.New("Invalid UUID specified as host for brick") + return nil, errors.New("invalid UUID specified as host for brick") } p, e := peer.GetPeerF(b.PeerID) diff --git a/glusterd2/volume/volume-utils.go b/glusterd2/volume/volume-utils.go index 37177335..237a969e 100644 --- a/glusterd2/volume/volume-utils.go +++ b/glusterd2/volume/volume-utils.go @@ -138,7 +138,7 @@ func GetBrickMountRoot(brickPath string) (string, error) { if mntSt := mntStat.Sys().(*syscall.Stat_t); brickSt.Dev == mntSt.Dev { return "/", nil } - return "", errors.New("Failed To Get Mount Root") + return "", errors.New("failed to get mount root") } //GetBrickMountInfo return mount related information @@ -153,7 +153,7 @@ func GetBrickMountInfo(mountRoot string) (*Mntent, error) { return entry, nil } } - return nil, errors.New("Mount Point Not Found") + return nil, errors.New("mount point not found") } diff --git a/glusterd2/xlator/options/options.go b/glusterd2/xlator/options/options.go index 7adc862e..b175f5c4 100644 --- a/glusterd2/xlator/options/options.go +++ b/glusterd2/xlator/options/options.go @@ -72,13 +72,13 @@ const ( ) // ErrInvalidArg validates if argument is Invalid -var ErrInvalidArg = errors.New("Invalid Value") +var ErrInvalidArg = errors.New("invalid Value") // ErrEmptyArg validates for empty arguments -var ErrEmptyArg = errors.New("No value passed") +var ErrEmptyArg = errors.New("no value passed") //ErrInvalidRange validates if option is out of range -var ErrInvalidRange = errors.New("Option is out of valid range") +var ErrInvalidRange = errors.New("option is out of valid range") // Option is a struct which represents one single xlator option exported by // the translator. diff --git a/pkg/elasticetcd/server.go b/pkg/elasticetcd/server.go index d7bc0bf7..47356c9f 100644 --- a/pkg/elasticetcd/server.go +++ b/pkg/elasticetcd/server.go @@ -68,7 +68,7 @@ func (ee *ElasticEtcd) startServer(initialCluster string) error { case <-time.After(42 * time.Second): ee.log.Debug("timedout trying to start embedded server") etcd.Server.Stop() // trigger a shutdown - return errors.New("Etcd embedded server took too long to start") + return errors.New("etcd embedded server took too long to start") case err := <-etcd.Err(): return err } diff --git a/pkg/errors/error.go b/pkg/errors/error.go index f62f6a4a..68f82a61 100644 --- a/pkg/errors/error.go +++ b/pkg/errors/error.go @@ -19,33 +19,33 @@ var ( ErrVolAlreadyStarted = errors.New("volume already started") ErrVolAlreadyStopped = errors.New("volume already stopped") ErrWrongGraphType = errors.New("graph: incorrect graph type") - ErrDeviceIDNotFound = errors.New("Failed to get device id") - ErrBrickIsMountPoint = errors.New("Brick path is already a mount point") - ErrBrickUnderRootPartition = errors.New("Brick path is under root partition") - ErrBrickNotDirectory = errors.New("Brick path is not a directory") - ErrBrickPathAlreadyInUse = errors.New("Brick path is already in use by other gluster volume") + ErrDeviceIDNotFound = errors.New("failed to get device id") + ErrBrickIsMountPoint = errors.New("brick path is already a mount point") + ErrBrickUnderRootPartition = errors.New("brick path is under root partition") + ErrBrickNotDirectory = errors.New("brick path is not a directory") + ErrBrickPathAlreadyInUse = errors.New("brick path is already in use by other gluster volume") ErrNoHostnamesPresent = errors.New("no hostnames present") - ErrBrickPathConvertFail = errors.New("Failed to convert the brickpath to absolute path") - ErrBrickNotLocal = errors.New("Brickpath doesn't belong to localhost") - ErrBrickPathTooLong = errors.New("Brickpath too long") + ErrBrickPathConvertFail = errors.New("failed to convert the brickpath to absolute path") + ErrBrickNotLocal = errors.New("brickpath doesn't belong to localhost") + ErrBrickPathTooLong = errors.New("brickpath too long") ErrSubDirPathTooLong = errors.New("sub directory path is too long") - ErrIPAddressNotFound = errors.New("Failed to find IP address") - ErrPeerLocalNode = errors.New("The peer being added is the local node") - ErrProcessNotFound = errors.New("The process is not running or is inaccessible") - ErrProcessAlreadyRunning = errors.New("Process is already running") - ErrBitrotAlreadyEnabled = errors.New("Bitrot is already enabled") - ErrBitrotAlreadyDisabled = errors.New("Bitrot is already disabled") - ErrBitrotNotEnabled = errors.New("Bitrot is not enabled") + ErrIPAddressNotFound = errors.New("failed to find IP address") + ErrPeerLocalNode = errors.New("peer being added is the local node") + ErrProcessNotFound = errors.New("process is not running or is inaccessible") + ErrProcessAlreadyRunning = errors.New("process is already running") + ErrBitrotAlreadyEnabled = errors.New("bitrot is already enabled") + ErrBitrotAlreadyDisabled = errors.New("bitrot is already disabled") + ErrBitrotNotEnabled = errors.New("bitrot is not enabled") ErrUnknownValue = errors.New("unknown value specified") ErrGetFailed = errors.New("failed to get value from the store") ErrUnmarshallFailed = errors.New("failed to unmarshall from json") - ErrClusterNotFound = errors.New("Cluster instance not found in store") - ErrDuplicateBrickPath = errors.New("Duplicate brick entry") - ErrRestrictedKeyFound = errors.New("Key names starting with '_' are restricted in metadata field") + ErrClusterNotFound = errors.New("cluster instance not found in store") + ErrDuplicateBrickPath = errors.New("duplicate brick entry") + ErrRestrictedKeyFound = errors.New("key names starting with '_' are restricted in metadata field") ErrVolFileNotFound = errors.New("volume file not found") - ErrEmptySnapName = errors.New("Snapshot name is empty") + ErrEmptySnapName = errors.New("snapshot name is empty") ErrSnapExists = errors.New("snapshot already exists") - ErrSnapNotFound = errors.New("Snapshot not found") + ErrSnapNotFound = errors.New("snapshot not found") ErrInvalidVolFlags = errors.New("invalid volume flags") ErrMetadataSizeOutOfBounds = errors.New("metadata size exceeds max allowed size of 4KB") ErrFetchingVolfileContent = errors.New("unable to fetch volfile content") diff --git a/pkg/sunrpc/errors.go b/pkg/sunrpc/errors.go index a99a59e9..c064faa1 100644 --- a/pkg/sunrpc/errors.go +++ b/pkg/sunrpc/errors.go @@ -38,17 +38,17 @@ func (e ErrProgMismatch) Error() string { // Given that the remote server accepted the RPC call, following errors // represent error status of an attempt to call remote procedure var ( - ErrProgUnavail = errors.New("Remote server has not exported program") - ErrProcUnavail = errors.New("Remote server has no such procedure") - ErrGarbageArgs = errors.New("Remote procedure cannot decode params") - ErrSystemErr = errors.New("System error on remote server") + ErrProgUnavail = errors.New("remote server has not exported program") + ErrProcUnavail = errors.New("remote server has no such procedure") + ErrGarbageArgs = errors.New("remote procedure cannot decode params") + ErrSystemErr = errors.New("system error on remote server") ) // These errors represent invalid replies from server and auth rejection. var ( - ErrInvalidRPCMessageType = errors.New("Invalid RPC message type received") - ErrInvalidRPCRepyType = errors.New("Invalid RPC reply received. Reply type should be MsgAccepted or MsgDenied") - ErrInvalidMsgDeniedType = errors.New("Invalid MsgDenied reply. Possible values are RPCMismatch and AuthError") - ErrInvalidMsgAccepted = errors.New("Invalid MsgAccepted reply received") - ErrAuthError = errors.New("Remote server rejected identity of the caller") + ErrInvalidRPCMessageType = errors.New("invalid RPC message type received") + ErrInvalidRPCRepyType = errors.New("invalid RPC reply received. Reply type should be MsgAccepted or MsgDenied") + ErrInvalidMsgDeniedType = errors.New("invalid MsgDenied reply. Possible values are RPCMismatch and AuthError") + ErrInvalidMsgAccepted = errors.New("invalid MsgAccepted reply received") + ErrAuthError = errors.New("remote server rejected identity of the caller") ) diff --git a/pkg/sunrpc/portmapper.go b/pkg/sunrpc/portmapper.go index 9f118a6c..dd00bbcc 100644 --- a/pkg/sunrpc/portmapper.go +++ b/pkg/sunrpc/portmapper.go @@ -78,7 +78,7 @@ func PmapSet(programNumber, programVersion uint32, protocol Protocol, port uint3 client := initPmapClient("") if client == nil { - return result, errors.New("Could not create pmap client") + return result, errors.New("could not create pmap client") } defer client.Close() @@ -101,7 +101,7 @@ func PmapUnset(programNumber, programVersion uint32) (bool, error) { client := initPmapClient("") if client == nil { - return result, errors.New("Could not create pmap client") + return result, errors.New("could not create pmap client") } defer client.Close() @@ -122,7 +122,7 @@ func PmapGetPort(host string, programNumber, programVersion uint32, protocol Pro client := initPmapClient(host) if client == nil { - return port, errors.New("Could not create pmap client") + return port, errors.New("could not create pmap client") } defer client.Close() @@ -154,7 +154,7 @@ func PmapGetMaps(host string) ([]PortMapping, error) { client := initPmapClient(host) if client == nil { - return nil, errors.New("Could not create pmap client") + return nil, errors.New("could not create pmap client") } defer client.Close() diff --git a/pkg/sunrpc/procedure_registry.go b/pkg/sunrpc/procedure_registry.go index 1704c59f..c358109b 100644 --- a/pkg/sunrpc/procedure_registry.go +++ b/pkg/sunrpc/procedure_registry.go @@ -67,7 +67,7 @@ func isValidProcedureName(procedureName string) bool { func RegisterProcedure(procedure Procedure, validateProcName bool) error { if validateProcName && !isValidProcedureName(procedure.Name) { - return errors.New("Invalid procedure name") + return errors.New("invalid procedure name") } procedureRegistry.Lock() diff --git a/pkg/utils/peerutils.go b/pkg/utils/peerutils.go index 7a74d48d..0f31c607 100644 --- a/pkg/utils/peerutils.go +++ b/pkg/utils/peerutils.go @@ -24,7 +24,7 @@ func FormRemotePeerAddress(peeraddress string) (string, error) { } if host == "" { - return "", errors.New("Invalid peer address") + return "", errors.New("invalid peer address") } remotePeerAddress := host + ":" + port diff --git a/pkg/utils/peerutils_test.go b/pkg/utils/peerutils_test.go index efd5a449..f08a2631 100644 --- a/pkg/utils/peerutils_test.go +++ b/pkg/utils/peerutils_test.go @@ -24,6 +24,6 @@ func TestFormRemotePeerAddress(t *testing.T) { assert.Equal(t, peer, "192.168.1.1:80") _, err = FormRemotePeerAddress(":8080") - assert.Contains(t, err.Error(), "Invalid peer address") + assert.Contains(t, err.Error(), "invalid peer address") } diff --git a/plugins/afr/validate.go b/plugins/afr/validate.go index a2657250..8e33b069 100644 --- a/plugins/afr/validate.go +++ b/plugins/afr/validate.go @@ -23,11 +23,11 @@ func validateOptions(v *volume.Volinfo, key string, value string) error { switch key { case "metadata-self-heal": if v.Subvols[0].ReplicaCount == 1 { - return errors.New("Option cannot be set for a non replicate volume") + return errors.New("option cannot be set for a non replicate volume") } case "self-heal-daemon": if !isVolReplicate(v.Type) { - return errors.New("Option cannot be set for a non replicate volume") + return errors.New("option cannot be set for a non replicate volume") } } return nil diff --git a/plugins/device/deviceutils/fstab.go b/plugins/device/deviceutils/fstab.go index ecbd49d5..8ff6184c 100644 --- a/plugins/device/deviceutils/fstab.go +++ b/plugins/device/deviceutils/fstab.go @@ -80,7 +80,7 @@ func (f *Fstab) load() error { } if len(parts) != 6 { - return errors.New("Invalid mount entry: " + line) + return errors.New("invalid mount entry: " + line) } f.Mounts = append(f.Mounts, FstabMount{ Device: parts[0], diff --git a/plugins/device/deviceutils/utils.go b/plugins/device/deviceutils/utils.go index 449fbe20..e62a174e 100644 --- a/plugins/device/deviceutils/utils.go +++ b/plugins/device/deviceutils/utils.go @@ -56,7 +56,7 @@ func GetVgAvailableSize(vgname string) (uint64, uint64, error) { vgdata := strings.Split(strings.TrimRight(string(out), "\n"), ":") if len(vgdata) != 17 { - return 0, 0, errors.New("Failed to get free size of VG: " + vgname) + return 0, 0, errors.New("failed to get free size of VG: " + vgname) } // Physical extent size index is 12 diff --git a/plugins/rebalance/errors.go b/plugins/rebalance/errors.go index 19638959..9f42a605 100644 --- a/plugins/rebalance/errors.go +++ b/plugins/rebalance/errors.go @@ -6,9 +6,9 @@ import ( var ( // ErrVolNotDistribute : Cannot run rebalance on a non distribute volume - ErrVolNotDistribute = errors.New("Not a distribute volume") + ErrVolNotDistribute = errors.New("not a distribute volume") // ErrRebalanceNotStarted : Rebalance not started on the volume - ErrRebalanceNotStarted = errors.New("Rebalance not started") + ErrRebalanceNotStarted = errors.New("rebalance not started") // ErrRebalanceInvalidOption : Invalid option provided to the rebalance start command - ErrRebalanceInvalidOption = errors.New("Invalid Rebalance start option") + ErrRebalanceInvalidOption = errors.New("invalid Rebalance start option") ) diff --git a/plugins/rebalance/utils.go b/plugins/rebalance/utils.go index 4065ad3b..cc1fd620 100644 --- a/plugins/rebalance/utils.go +++ b/plugins/rebalance/utils.go @@ -65,7 +65,7 @@ func GetRebalanceInfo(volname string) (*rebalanceapi.RebalInfo, error) { if resp.Count != 1 { log.WithField("volume", volname).Error("Rebalance info not found for the volume or rebalance process is not started for this volume") - return nil, errors.New("Rebalance info not found for the volume or rebalance process is not started for this volume") + return nil, errors.New("rebalance info not found for the volume or rebalance process is not started for this volume") } if err = json.Unmarshal(resp.Kvs[0].Value, &rebalinfo); err != nil { diff --git a/plugins/smartvol/bricksplanner/planner.go b/plugins/smartvol/bricksplanner/planner.go index 9d8063bf..00372e94 100644 --- a/plugins/smartvol/bricksplanner/planner.go +++ b/plugins/smartvol/bricksplanner/planner.go @@ -18,11 +18,11 @@ func handleReplicaSubvolReq(req *smartvolapi.Volume) error { } if req.ReplicaCount > 3 { - return errors.New("Invalid Replica Count") + return errors.New("invalid Replica Count") } req.SubvolType = "replicate" if req.ArbiterCount > 1 { - return errors.New("Invalid Arbiter Count") + return errors.New("invalid Arbiter Count") } return nil @@ -36,7 +36,7 @@ func handleDisperseSubvolReq(req *smartvolapi.Volume) error { req.SubvolType = "disperse" if req.DisperseDataCount > 0 && req.DisperseRedundancyCount <= 0 { - return errors.New("Disperse redundancy count is required") + return errors.New("disperse redundancy count is required") } if req.DisperseDataCount > 0 { @@ -53,7 +53,7 @@ func handleDisperseSubvolReq(req *smartvolapi.Volume) error { } if 2*req.DisperseRedundancyCount >= req.DisperseCount { - return errors.New("Invalid redundancy count") + return errors.New("invalid redundancy count") } return nil @@ -88,7 +88,7 @@ func getBricksLayout(req *smartvolapi.Volume) ([]smartvolapi.Subvol, error) { } if req.SnapshotReserveFactor < 1 { - return nil, errors.New("Invalid Snapshot Reserve Factor") + return nil, errors.New("invalid Snapshot Reserve Factor") } // Default Subvol Type @@ -108,7 +108,7 @@ func getBricksLayout(req *smartvolapi.Volume) ([]smartvolapi.Subvol, error) { subvolplanner, exists := subvolPlanners[req.SubvolType] if !exists { - return nil, errors.New("Sub volume type not supported") + return nil, errors.New("subvolume type not supported") } // Initialize the planner @@ -157,7 +157,7 @@ func PlanBricks(req *smartvolapi.Volume) error { } if len(availableVgs) == 0 { - return errors.New("No devices registered or available for allocating bricks") + return errors.New("no devices registered or available for allocating bricks") } subvols, err := getBricksLayout(req) @@ -226,7 +226,7 @@ func PlanBricks(req *smartvolapi.Volume) error { // If the devices are not available as it is required for Volume. if len(sv.Bricks) != numBricksAllocated { - return errors.New("No space available or all the devices are not registered") + return errors.New("no space available or all the devices are not registered") } } diff --git a/plugins/smartvol/rest.go b/plugins/smartvol/rest.go index 2030f4c9..0bc86233 100644 --- a/plugins/smartvol/rest.go +++ b/plugins/smartvol/rest.go @@ -28,11 +28,11 @@ func validateVolCreateReq(req *smartvolapi.VolCreateReq) error { } if req.Transport != "" && req.Transport != "tcp" && req.Transport != "rdma" { - return errors.New("Invalid transport. Supported values: tcp or rdma") + return errors.New("invalid transport. Supported values: tcp or rdma") } if req.Size < minVolumeSize { - return errors.New("Invalid Volume Size, Minimum size required is " + strconv.Itoa(minVolumeSize)) + return errors.New("invalid Volume Size, Minimum size required is " + strconv.Itoa(minVolumeSize)) } return nil @@ -109,7 +109,7 @@ func smartVolumeCreateHandler(w http.ResponseWriter, r *http.Request) { applyDefaults(&req) if req.SnapshotReserveFactor < 1 { - restutils.SendHTTPError(ctx, w, http.StatusBadRequest, errors.New("Invalid Snapshot Reserve Factor")) + restutils.SendHTTPError(ctx, w, http.StatusBadRequest, errors.New("invalid Snapshot Reserve Factor")) return }