fix: remove deprecated ioutil and rand calls
- Change ioutil to io and os calls per Go 1.16 deprecation - Move global random to localized random source
This commit is contained in:
5
db.go
5
db.go
@@ -9,7 +9,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
"os"
|
||||
@@ -292,7 +291,7 @@ func (db *DB) invalidatePos(ctx context.Context) error {
|
||||
}
|
||||
defer rd.Close()
|
||||
|
||||
n, err := io.Copy(ioutil.Discard, lz4.NewReader(rd))
|
||||
n, err := io.Copy(io.Discard, lz4.NewReader(rd))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -671,7 +670,7 @@ func (db *DB) cleanGenerations(ctx context.Context) error {
|
||||
}
|
||||
|
||||
dir := filepath.Join(db.MetaPath(), "generations")
|
||||
fis, err := ioutil.ReadDir(dir)
|
||||
fis, err := os.ReadDir(dir)
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
} else if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user