mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 01:40:07 +01:00
addrmgr/btcd: Updates for staticcheck results.
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.
This commit is contained in:
parent
82cba61bad
commit
aa53c14a19
@ -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}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user