Skip to content

Commit

Permalink
Address linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybear327 committed Apr 2, 2024
1 parent 6faeac5 commit 3c89ea6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fmt:

.PHONY: verify
verify:
golangci-lint run ./...
golangci-lint run --config tools/.golangci.yaml ./...

# Local development build
build:
Expand Down
4 changes: 2 additions & 2 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type analyzeOptions struct {
filename string
}

var analyzeOpts *analyzeOptions = &analyzeOptions{}
var analyzeOpts = &analyzeOptions{}

func init() {
RootCmd.AddCommand(analyzeCmd)
Expand All @@ -52,7 +52,7 @@ func analyzeValidateAndRun() error {
objectCounts := map[string]uint{}
for _, s := range summaries {
if s.TypeMeta != nil {
objectCounts[fmt.Sprintf("%s/%s", s.TypeMeta.APIVersion, s.TypeMeta.Kind)] += 1
objectCounts[fmt.Sprintf("%s/%s", s.TypeMeta.APIVersion, s.TypeMeta.Kind)]++
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type checksumOptions struct {
revision int64
}

var checksumOpts *checksumOptions = &checksumOptions{}
var checksumOpts = &checksumOptions{}

func init() {
RootCmd.AddCommand(checksumCmd)
Expand Down
7 changes: 3 additions & 4 deletions cmd/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type decodeOptions struct {
batchProcess bool // special flag to handle incoming etcd-dump-logs output
}

var options *decodeOptions = &decodeOptions{}
var options = &decodeOptions{}

func init() {
RootCmd.AddCommand(decodeCmd)
Expand Down Expand Up @@ -124,7 +124,7 @@ func runInBatchMode(metaOnly bool, outMediaType string, out io.Writer) (err erro
return nil
}
if err != nil {
return fmt.Errorf("error reading --batch-process input: %v\n", err)
return fmt.Errorf("error reading --batch-process input: %v", err)
}

input = stripNewline(input)
Expand Down Expand Up @@ -210,7 +210,6 @@ func readInput(inputFilename string) ([]byte, error) {
func stripNewline(d []byte) []byte {
if len(d) > 0 && d[len(d)-1] == '\n' {
return d[:len(d)-1]
} else {
return d
}
return d
}
2 changes: 1 addition & 1 deletion cmd/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type encodeOptions struct {
inputFilename string
}

var encodeOpts *encodeOptions = &encodeOptions{}
var encodeOpts = &encodeOptions{}

func init() {
RootCmd.AddCommand(encodeCmd)
Expand Down
6 changes: 3 additions & 3 deletions cmd/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type extractOptions struct {
filter string
}

var opts *extractOptions = &extractOptions{}
var opts = &extractOptions{}

func init() {
RootCmd.AddCommand(extractCmd)
Expand Down Expand Up @@ -250,7 +250,7 @@ func printLeafItemValue(kv *mvccpb.KeyValue, outMediaType string, out io.Writer)
// printKeySummaries prints all keys in the db file with the given key prefix.
func printKeySummaries(filename string, keyPrefix string, revision int64, fields []string, out io.Writer) error {
if len(fields) == 0 {
return fmt.Errorf("no fields provided, nothing to output.")
return fmt.Errorf("no fields provided, nothing to output")
}

var hasKey bool
Expand Down Expand Up @@ -288,7 +288,7 @@ func printTemplateSummaries(filename string, keyPrefix string, revision int64, t
}

if len(templatestr) == 0 {
return fmt.Errorf("no template provided, nothing to output.")
return fmt.Errorf("no template provided, nothing to output")
}

filters := []data.Filter{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/data/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func ListKeySummaries(filename string, filters []Filter, proj *KeySummaryProject
ks.Version = kv.ModRevision
ks.Stats.ValueSize = len(kv.Value)
}
ks.Stats.VersionCount += 1
ks.Stats.VersionCount++
ks.Stats.AllVersionsKeySize += len(kv.Key)
ks.Stats.AllVersionsValueSize += len(kv.Value)
}
Expand Down

0 comments on commit 3c89ea6

Please sign in to comment.