Skip to content

Commit

Permalink
addrmgr/btcd: Updates for staticcheck results.
Browse files Browse the repository at this point in the history
This makes two modifications based on the results of staticcheck.

The first is to use a simplified zero value for the time in the addrmgr
package tests.

The second is check any errors when opening a directory while attempting
to perform old version upgrades.
  • Loading branch information
davecgh committed Nov 3, 2016
1 parent 82cba61 commit aa53c14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addrmgr/knownaddress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestIsBad(t *testing.T) {
secondsOld := time.Now().Add(-2 * time.Second)
minutesOld := time.Now().Add(-27 * time.Minute)
hoursOld := time.Now().Add(-5 * time.Hour)
zeroTime, _ := time.Parse("Jan 1, 1970 at 0:00am (GMT)", "Jan 1, 1970 at 0:00am (GMT)")
zeroTime := time.Time{}

futureNa := &wire.NetAddress{Timestamp: future}
minutesOldNa := &wire.NetAddress{Timestamp: minutesOld}
Expand Down
3 changes: 3 additions & 0 deletions upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
// dirEmpty returns whether or not the specified directory path is empty.
func dirEmpty(dirPath string) (bool, error) {
f, err := os.Open(dirPath)
if err != nil {
return false, err
}
defer f.Close()

// Read the names of a max of one entry from the directory. When the
Expand Down

0 comments on commit aa53c14

Please sign in to comment.