Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aswinkarthik committed Aug 12, 2019
1 parent 796d908 commit fe1dd8b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 23 deletions.
4 changes: 1 addition & 3 deletions cmd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ func TestValueColumnPositions(t *testing.T) {
}

func TestConfigValidate(t *testing.T) {
var config *cmd.Config

config = &cmd.Config{}
config := &cmd.Config{}
assert.Error(t, config.Validate())

config = &cmd.Config{Format: "rowmark"}
Expand Down
7 changes: 2 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
)

var (
cfgFile string
timed bool
)

Expand Down Expand Up @@ -91,16 +90,14 @@ Most suitable for csv files created from database tables`,
diff, err := digest.Diff(*baseConfig, *deltaConfig)

if err != nil {
fmt.Fprintf(os.Stderr, "csvdiff failed: %v\n", err)
_, _ = fmt.Fprintf(os.Stderr, "csvdiff failed: %v\n", err)
os.Exit(2)
}

if err := NewFormatter(os.Stdout, os.Stderr, config).Format(diff); err != nil {
fmt.Fprintf(os.Stderr, "csvdiff failed: %v\n", err)
_, _ = fmt.Fprintf(os.Stderr, "csvdiff failed: %v\n", err)
os.Exit(3)
}

return
},
}

Expand Down
12 changes: 2 additions & 10 deletions pkg/digest/digest_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ func CreateDigestFor(count int, b *testing.B) {
}

b.StartTimer()
Create(config)
}

type Csv struct {
counter int
limit int
_, _, _ = Create(config)
}

type Reader struct {
Expand All @@ -54,8 +49,5 @@ func (r *Reader) Read(p []byte) (n int, err error) {
}
toRead := fmt.Sprintf("%d,%s\n", r.counter, SomeText)
r.counter++
for i, b := range []byte(toRead) {
p[i] = b
}
return len(toRead), nil
return copy(p, toRead), nil
}
1 change: 0 additions & 1 deletion pkg/digest/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
// Engine to create a FileDigest
type Engine struct {
config Config
reader *csv.Reader
lock *sync.Mutex
}

Expand Down
6 changes: 2 additions & 4 deletions pkg/digest/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,8 @@ func TestEngine_GenerateFileDigest(t *testing.T) {
func digestsFrom(digestChan chan []digest.Digest) []digest.Digest {
result := make([]digest.Digest, 0, 10)

for rcvd := range digestChan {
for _, d := range rcvd {
result = append(result, d)
}
for d := range digestChan {
result = append(result, d...)
}

return result
Expand Down

0 comments on commit fe1dd8b

Please sign in to comment.