Skip to content

Commit 3288deb

Browse files
committed
Avoid shadowed variables
1 parent 60bee8e commit 3288deb

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

add_cmd_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ https://example.net/
2424
t.Fatalf("Error creating temporary file")
2525
}
2626

27-
if _, err := tmpfile.Write(data); err != nil {
27+
if _, err = tmpfile.Write(data); err != nil {
2828
t.Fatalf("Error writing to config file")
2929
}
30-
if err := tmpfile.Close(); err != nil {
30+
if err = tmpfile.Close(); err != nil {
3131
t.Fatalf("Error creating temporary file")
3232
}
3333

del_cmd_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ https://example.net/
2323
t.Fatalf("Error creating temporary file")
2424
}
2525

26-
if _, err := tmpfile.Write(data); err != nil {
26+
if _, err = tmpfile.Write(data); err != nil {
2727
t.Fatalf("Error writing to config file")
2828
}
29-
if err := tmpfile.Close(); err != nil {
29+
if err = tmpfile.Close(); err != nil {
3030
t.Fatalf("Error creating temporary file")
3131
}
3232

import_cmd.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ func (i *importCmd) Execute(args []string) int {
8282
for _, file := range args {
8383

8484
// Read content
85-
data, err := ioutil.ReadFile(file)
85+
var data []byte
86+
data, err = ioutil.ReadFile(file)
8687
if err != nil {
8788
fmt.Printf("failed to read %s: %s\n", file, err.Error())
8889
continue

import_cmd_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ https://example.net/
2222
t.Fatalf("Error creating temporary file")
2323
}
2424

25-
if _, err := tmpfile.Write(data); err != nil {
25+
if _, err = tmpfile.Write(data); err != nil {
2626
t.Fatalf("Error writing to config file")
2727
}
28-
if err := tmpfile.Close(); err != nil {
28+
if err = tmpfile.Close(); err != nil {
2929
t.Fatalf("Error creating temporary file")
3030
}
3131

processor/processor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (p *Processor) ProcessFeeds(recipients []string) []error {
126126
}
127127

128128
// Process this specific entry.
129-
err := p.processFeed(entry, feedRecipients)
129+
err = p.processFeed(entry, feedRecipients)
130130
if err != nil {
131131
errors = append(errors, fmt.Errorf("error processing %s - %s", entry.URL, err))
132132
}

0 commit comments

Comments
 (0)