Skip to content

Commit 0d8da25

Browse files
committed
fixed code style
1 parent 4634491 commit 0d8da25

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

badger/cmd/info.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package cmd
88
import (
99
"bytes"
1010
"encoding/hex"
11-
stderrors "errors"
11+
"errors"
1212
"fmt"
1313
"io/fs"
1414
"os"
@@ -48,8 +48,8 @@ type flagOptions struct {
4848
var (
4949
opt flagOptions
5050

51-
// ErrInvalidChecksumAlgorithm is returned if the checksum algorithm is invalid.
52-
ErrInvalidChecksumAlgorithm = stderrors.New("Invalid checksum algorithm. Supported values: crc32c, xxhash64.")
51+
// errInvalidChecksumAlgorithm is returned if the checksum algorithm is invalid.
52+
errInvalidChecksumAlgorithm = errors.New("Invalid checksum algorithm. Supported values: crc32c, xxhash64.")
5353
)
5454

5555
func init() {
@@ -98,9 +98,7 @@ to the Dgraph team.
9898
func handleInfo(cmd *cobra.Command, args []string) error {
9999
cvMode := checksumVerificationMode(opt.checksumVerificationMode)
100100
ct, err := strToChecksumAlgorithm(opt.checksumAlgorithm)
101-
if err != nil {
102-
y.Check(err)
103-
}
101+
y.Check(err)
104102

105103
bopt := badger.DefaultOptions(sstDir).
106104
WithValueDir(vlogDir).
@@ -537,7 +535,7 @@ func strToChecksumAlgorithm(ct string) (pb.Checksum_Algorithm, error) {
537535
case "xxhash64":
538536
return pb.Checksum_XXHash64, nil
539537
default:
540-
return pb.Checksum_CRC32C, y.Wrap(ErrInvalidChecksumAlgorithm,
538+
return pb.Checksum_CRC32C, y.Wrap(errInvalidChecksumAlgorithm,
541539
"InvalidChecksumAlgorithm")
542540
}
543541
}

badger/cmd/info_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ package cmd
1818

1919
import (
2020
"fmt"
21+
"testing"
22+
2123
"github.com/dgraph-io/badger/v4/pb"
2224
"github.com/stretchr/testify/require"
23-
"testing"
2425
)
2526

2627
func TestStrToChecksumAlgorithm(t *testing.T) {

0 commit comments

Comments
 (0)