fix error formatting/spelling

Go convention is that error messages don't end with periods and
don't start with capital letters.
This commit is contained in:
Seebs 2021-08-11 15:29:03 -05:00
parent ab9b70d7e8
commit 6af987a5ba
4 changed files with 12 additions and 12 deletions

View file

@ -281,7 +281,7 @@ func (w *BoltWrapper) DeleteIndex(indexName string) error {
// index name in the key prefix, so we cannot allow indexNames
// themselves to contain apostrophies.
if strings.Contains(indexName, "/") {
return fmt.Errorf("error: bad indexName `%v` in BoltWrapper.DeleteIndex() call: indexName cannot contain '/'.", indexName)
return fmt.Errorf("error: bad indexName `%v` in BoltWrapper.DeleteIndex() call: indexName cannot contain '/'", indexName)
}
prefix := txkey.IndexOnlyPrefix(indexName)
return w.DeletePrefix(prefix)

2
rbf.go
View file

@ -542,7 +542,7 @@ func (w *RbfDBWrapper) DeleteField(index, field, fieldPath string) error {
func (w *RbfDBWrapper) DeleteIndex(indexName string) error {
if strings.Contains(indexName, "'") {
return fmt.Errorf("error: bad indexName `%v` in RbfDBWrapper.DeleteIndex() call: indexName cannot contain apostrophes/single quotes.", indexName)
return fmt.Errorf("error: bad indexName `%v` in RbfDBWrapper.DeleteIndex() call: indexName cannot contain apostrophes/single quotes", indexName)
}
prefix := txkey.IndexOnlyPrefix(indexName)

10
time.go
View file

@ -257,16 +257,16 @@ func parsePartialTime(t string) (time.Time, error) {
// has minutes
minute, err = strconv.Atoi(subStrings[1])
if err != nil {
return -1, -1, errors.New("Invalid Time")
return -1, -1, errors.New("invalid time")
}
fallthrough
case 1:
hour, err = strconv.Atoi(subStrings[0])
if err != nil {
return -1, -1, errors.New("Invalid Time")
return -1, -1, errors.New("invalid time")
}
default:
return -1, -1, errors.New("Invalid Time")
return -1, -1, errors.New("invalid time")
}
return
@ -282,7 +282,7 @@ func parsePartialTime(t string) (time.Time, error) {
return true
}
if len(subMatches) <= 1 {
return nil, errors.New("Invalid time")
return nil, errors.New("invalid time")
}
// ignore full match which is at index 0
subMatches = subMatches[1:] // ignore full match which is at index 0
@ -295,7 +295,7 @@ func parsePartialTime(t string) (time.Time, error) {
} else {
// rest must be empty for date-time to be valid
if !restAreEmpty(subMatches[i:]) {
return nil, errors.New("Invalid date-time")
return nil, errors.New("invalid date-time")
}
break
}

View file

@ -1383,7 +1383,7 @@ func (f *TxFactory) greenHasData() (hasData bool, err error) {
case 2:
return f.dbPerShard.HasData(1)
}
err = fmt.Errorf("unsupported len(f.types): %v. Must be 1 or 2.", n)
err = fmt.Errorf("unsupported len(f.types): %v; must be 1 or 2", n)
PanicOn(err)
return
}
@ -1410,7 +1410,7 @@ func (f *TxFactory) green2blue(holder *Holder) (err0 error) {
greenSrc := f.types[1]
if blueDest == roaringTxn {
return fmt.Errorf("error: cannot migrate to 'roaring': not implemented.")
return fmt.Errorf("error: cannot migrate to 'roaring': not implemented")
}
idxs := holder.Indexes()
@ -1427,13 +1427,13 @@ func (f *TxFactory) green2blue(holder *Holder) (err0 error) {
return errors.Wrap(err, "TxFactory.green2blue f.greenHasData()")
}
if !blueHasData && !greenHasData {
holder.Logger.Infof("no data in blue or green. No migration or verification to do.")
holder.Logger.Infof("no data in blue or green. No migration or verification to do")
return nil
}
// INVAR: blue has data.
if !greenHasData {
holder.Logger.Errorf("cannot migrate from green '%v' because it has no data in it.", greenSrc)
return fmt.Errorf("error: cannot migrate from green '%v' because it has no data in it.", greenSrc)
holder.Logger.Errorf("cannot migrate from green '%v' because it has no data in it", greenSrc)
return fmt.Errorf("error: cannot migrate from green '%v' because it has no data in it", greenSrc)
}
nGoro := runtime.NumCPU()