diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 5476df7..da43c93 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -9,13 +9,13 @@ jobs: name: Test Builds runs-on: ubuntu-latest steps: + - name: Check out code + uses: actions/checkout@v3 + - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.21 - - - name: Check out code - uses: actions/checkout@v3 + go-version-file: go.mod - name: Test run: go test ./... diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index 551f2a8..fea8ba6 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -9,10 +9,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v7 + - name: Set up Go + uses: actions/setup-go@v7 + with: + go-version-file: go.mod - name: Run golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v9 with: version: latest args: --timeout 5m - working-directory: . \ No newline at end of file + working-directory: . diff --git a/cmd/example/example.go b/cmd/example/example.go index bcd58e0..79001e1 100644 --- a/cmd/example/example.go +++ b/cmd/example/example.go @@ -32,14 +32,14 @@ func normal(wg *sync.WaitGroup) { if err != nil { log.Fatal(err) } - defer hm.Close() + defer func() { _ = hm.Close() }() err2 := hm.Set("a", []byte("b")) if err2 != nil { log.Fatal(err2) } v, ok := hm.Get("a") if ok { - log.Println(v) + log.Println(string(v)) } } @@ -53,7 +53,7 @@ func memoryExpire(wg *sync.WaitGroup) { if err != nil { log.Fatal(err) } - defer hm.Close() + defer func() { _ = hm.Close() }() err2 := hm.Set("a", []byte("b")) if err2 != nil { log.Fatal(err2) @@ -73,7 +73,7 @@ func disk(wg *sync.WaitGroup) { if err != nil { log.Fatal(err) } - defer hm.Close() + defer func() { _ = hm.Close() }() err2 := hm.Set("a", []byte("b")) if err2 != nil { log.Fatal(err2) @@ -99,7 +99,7 @@ func hybridz(wg *sync.WaitGroup) { if err != nil { log.Fatal(err) } - defer hm.Close() + defer func() { _ = hm.Close() }() err2 := hm.Set("a", []byte("b")) if err2 != nil { log.Fatal(err2) @@ -108,7 +108,7 @@ func hybridz(wg *sync.WaitGroup) { // this should happen from disk v, ok := hm.Get("a") if ok { - log.Println("Read1 (disk)", v) + log.Println("Read1 (disk)", string(v)) } else { log.Println("Read1 (disk) Not found") } @@ -124,7 +124,7 @@ func hybridz(wg *sync.WaitGroup) { // this should happen from memory again v3, ok3 := hm.Get("a") if ok3 { - log.Println("Read2 (memory)", v3) + log.Println("Read2 (memory)", string(v3)) } else { log.Println("Read2 (memory) Not found") } @@ -193,7 +193,7 @@ func testhybrid(name string, opts hybrid.Options, total int) (duration time.Dura read := 0 hm.Scan(func(k, v []byte) error { gotValue := string(v) - if "test" != gotValue { + if gotValue != "test" { return errors.New("unexpected item") } read++ diff --git a/cmd/filekv/filekv.go b/cmd/filekv/filekv.go index 34c9e24..8b71255 100644 --- a/cmd/filekv/filekv.go +++ b/cmd/filekv/filekv.go @@ -16,29 +16,29 @@ func main() { list1, list2, list3 := "list1.txt", "list2.txt", "list3.txt" fList1, _ := os.Create(list1) for i := 0; i < 100000; i++ { - _, _ = fList1.WriteString(fmt.Sprintf("%d\n", i)) + _, _ = fmt.Fprintf(fList1, "%d\n", i) } - fList1.Close() + _ = fList1.Close() fList2, _ := os.Create(list2) // 1000 items overlaps for i := 90000; i < 200000; i++ { - _, _ = fList2.WriteString(fmt.Sprintf("%d\n", i)) + _, _ = fmt.Fprintf(fList2, "%d\n", i) } - fList2.Close() + _ = fList2.Close() // third list is still on disk but will be used as io.reader fList3, _ := os.Create(list3) // 1000 items overlaps for i := 190000; i < 300000; i++ { - _, _ = fList3.WriteString(fmt.Sprintf("%d\n", i)) + _, _ = fmt.Fprintf(fList3, "%d\n", i) } - fList3.Close() + _ = fList3.Close() // 4th list will be a list of new-line separated numbers var list4 strings.Builder for i := 290000; i < 400000; i++ { - list4.WriteString(fmt.Sprintf("%d\n", i)) + fmt.Fprintf(&list4, "%d\n", i) } opts := filekv.DefaultOptions diff --git a/filekv/file.go b/filekv/file.go index 919956c..90ff437 100644 --- a/filekv/file.go +++ b/filekv/file.go @@ -138,11 +138,11 @@ func (fdb *FileDB) Process() error { _ = fdb.Set(sc.Bytes(), nil) } - fdb.tmpDb.Close() + _ = fdb.tmpDb.Close() // flush to disk - fdb.dbWriter.Close() - fdb.db.Close() + _ = fdb.dbWriter.Close() + _ = fdb.db.Close() // cleanup filters switch fdb.options.Dedupe { @@ -153,8 +153,8 @@ func (fdb *FileDB) Process() error { case MemoryFilter: fdb.bdb.ClearAll() case DiskFilter: - fdb.ddb.Close() - os.RemoveAll(fdb.ddbName) + _ = fdb.ddb.Close() + _ = os.RemoveAll(fdb.ddbName) } return nil @@ -172,8 +172,8 @@ func (fdb *FileDB) Reset() error { fdb.bdb.ClearAll() case DiskFilter: // close - remove - reopen - fdb.ddb.Close() - os.RemoveAll(fdb.ddbName) + _ = fdb.ddb.Close() + _ = os.RemoveAll(fdb.ddbName) var err error fdb.ddb, err = leveldb.OpenFile(fdb.ddbName, nil) if err != nil { @@ -182,7 +182,7 @@ func (fdb *FileDB) Reset() error { } // reset the tmp file - fdb.tmpDb.Close() + _ = fdb.tmpDb.Close() var err error fdb.tmpDb, err = os.Create(fdb.tmpDbName) if err != nil { @@ -190,7 +190,7 @@ func (fdb *FileDB) Reset() error { } // reset the target file - fdb.db.Close() + _ = fdb.db.Close() fdb.db, err = os.Create(fdb.tmpDbName) if err != nil { return err @@ -220,17 +220,17 @@ func (fdb *FileDB) Size() int64 { func (fdb *FileDB) Close() { tmpDBFilename := fdb.tmpDb.Name() _ = fdb.tmpDb.Close() - os.RemoveAll(tmpDBFilename) + _ = os.RemoveAll(tmpDBFilename) _ = fdb.db.Close() dbFilename := fdb.db.Name() if fdb.options.Cleanup { - os.RemoveAll(dbFilename) + _ = os.RemoveAll(dbFilename) } if fdb.ddbName != "" { - fdb.ddb.Close() - os.RemoveAll(fdb.ddbName) + _ = fdb.ddb.Close() + _ = os.RemoveAll(fdb.ddbName) } } @@ -292,7 +292,7 @@ func (fdb *FileDB) Scan(handler func([]byte, []byte) error) error { if err != nil { return err } - defer dbCopy.Close() + defer func() { _ = dbCopy.Close() }() var dbReader io.ReadCloser if fdb.options.Compress { diff --git a/filekv/merge.go b/filekv/merge.go index f13db1e..4209d6e 100644 --- a/filekv/merge.go +++ b/filekv/merge.go @@ -65,7 +65,7 @@ func (f *FileDB) MergeFile(filename string) (uint, error) { if err != nil { return 0, err } - defer newF.Close() + defer func() { _ = newF.Close() }() return f.MergeReader(newF) } diff --git a/go.mod b/go.mod index 7841626..ecfcf09 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,15 @@ module github.com/projectdiscovery/hmap -go 1.24.0 +go 1.26.0 require ( github.com/akrylysov/pogreb v0.10.1 github.com/bits-and-blooms/bloom/v3 v3.5.0 github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/pkg/errors v0.9.1 - github.com/projectdiscovery/utils v0.11.1 + github.com/projectdiscovery/utils v0.11.9 github.com/rs/xid v1.5.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/syndtr/goleveldb v1.0.0 github.com/tidwall/buntdb v1.3.0 go.etcd.io/bbolt v1.3.7 @@ -19,14 +19,12 @@ require ( github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.13.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/golang/snappy v0.0.4 // indirect github.com/gorilla/css v1.0.1 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/microcosm-cc/bluemonday v1.0.27 // indirect github.com/onsi/ginkgo v1.16.4 // indirect github.com/onsi/gomega v1.16.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/projectdiscovery/blackrock v0.0.2 // indirect github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect github.com/tidwall/btree v1.4.3 // indirect @@ -36,8 +34,9 @@ require ( github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/rtred v0.1.2 // indirect github.com/tidwall/tinyqueue v0.1.1 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect - golang.org/x/net v0.48.0 // indirect - golang.org/x/sys v0.41.0 // indirect + golang.org/x/net v0.55.0 // indirect + golang.org/x/sys v0.45.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 9e55e80..f4694e6 100644 --- a/go.sum +++ b/go.sum @@ -11,8 +11,6 @@ github.com/bits-and-blooms/bloom/v3 v3.5.0 h1:AKDvi1V3xJCmSR6QhcBfHbCN4Vf8FfxeWk github.com/bits-and-blooms/bloom/v3 v3.5.0/go.mod h1:Y8vrn7nk1tPIlmLtW2ZPV+W7StdVMor6bC1xgpjMZFs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -59,20 +57,18 @@ github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/projectdiscovery/blackrock v0.0.2 h1:mxXdu0uM8P2L2Qi210COlU8QiICPFW/Rxk5QUhlPO2k= github.com/projectdiscovery/blackrock v0.0.2/go.mod h1:ANUtjDfaVrqB453bzToU+YB4cUbvBRpLvEwoWIwlTss= -github.com/projectdiscovery/utils v0.11.1 h1:PWj1KjIASxt8icxommH72C0TQqNOvGkcSODRkiq0SQw= -github.com/projectdiscovery/utils v0.11.1/go.mod h1:yktGrHGk2CTjNiccXovnvGrLHX9sV2bqz9nSnbA3V8M= +github.com/projectdiscovery/utils v0.11.9 h1:aKLje3zPcZuOGmopN51PasWxPX/CypPwzP2ke/Qa2bA= +github.com/projectdiscovery/utils v0.11.9/go.mod h1:d3BcbsHhuxW9T3jpvrgzwshvqhaL9qPSkoi+3h/DY8E= github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d h1:hrujxIzL1woJ7AwssoOcM/tq5JjjG2yYOc8odClEiXA= github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d/go.mod h1:uugorj2VCxiV1x+LzaIdVa9b4S4qGAcH6cbhh4qVxOU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/tidwall/assert v0.1.0 h1:aWcKyRBUAdLoVebxo95N7+YZVTFF/ASTr7BN4sLP6XI= @@ -104,6 +100,8 @@ go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -116,8 +114,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= -golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= +golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -133,14 +131,14 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= -golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= +golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= -golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= +golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= +golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= diff --git a/store/disk/bboltdb.go b/store/disk/bboltdb.go index e7b0939..643c9c3 100644 --- a/store/disk/bboltdb.go +++ b/store/disk/bboltdb.go @@ -39,7 +39,7 @@ func (b *BBoltDB) Size() int64 { // Close ... func (b *BBoltDB) Close() { - b.db.Close() + _ = b.db.Close() } // GC - runs the garbage collector diff --git a/store/disk/buntdb.go b/store/disk/buntdb.go index c364aa9..c7abe02 100644 --- a/store/disk/buntdb.go +++ b/store/disk/buntdb.go @@ -35,7 +35,7 @@ func (bdb *BuntDB) Size() int64 { // Close func (bdb *BuntDB) Close() { - bdb.db.Close() + _ = bdb.db.Close() } // GC - runs the garbage collector diff --git a/store/disk/kv_test.go b/store/disk/kv_test.go index 6552ec2..fece9cc 100644 --- a/store/disk/kv_test.go +++ b/store/disk/kv_test.go @@ -58,7 +58,7 @@ func TestKV(t *testing.T) { func TestFileKV(t *testing.T) { dbpath, _ := fileutil.GetTempFileName() - os.RemoveAll(dbpath) + _ = os.RemoveAll(dbpath) opts := filekv.DefaultOptions opts.Cleanup = true opts.Compress = true diff --git a/store/disk/leveldb.go b/store/disk/leveldb.go index 97caf23..3279946 100644 --- a/store/disk/leveldb.go +++ b/store/disk/leveldb.go @@ -50,7 +50,7 @@ func (ldb *LevelDB) Size() int64 { // Close ... func (ldb *LevelDB) Close() { - ldb.db.Close() + _ = ldb.db.Close() } // GC - runs the garbage collector diff --git a/store/disk/pogreb_all.go b/store/disk/pogreb_all.go index 8887c33..a378220 100644 --- a/store/disk/pogreb_all.go +++ b/store/disk/pogreb_all.go @@ -45,7 +45,7 @@ func (pdb *PogrebDB) Size() int64 { // Close ... func (pdb *PogrebDB) Close() { - pdb.db.Close() + _ = pdb.db.Close() } // GC - runs the garbage collector diff --git a/store/disk/util_test.go b/store/disk/util_test.go index ec63acf..81a8a80 100644 --- a/store/disk/util_test.go +++ b/store/disk/util_test.go @@ -77,5 +77,5 @@ func utiltestGetPath(t *testing.T) (string, error) { func utiltestRemoveDb(t *testing.T, db DB, pbpath string) { db.Close() - os.RemoveAll(pbpath) + _ = os.RemoveAll(pbpath) } diff --git a/store/hybrid/hybrid.go b/store/hybrid/hybrid.go index 61dbfe8..8b3f793 100644 --- a/store/hybrid/hybrid.go +++ b/store/hybrid/hybrid.go @@ -107,7 +107,7 @@ func New(options Options) (*HybridMap, error) { modTime := tmpFileInfo.ModTime() if now.Sub(modTime) > options.RemoveOlderThan { targetFolderFullPath := filepath.Join(targetCleanupDir, tmpFileInfo.Name()) - os.RemoveAll(targetFolderFullPath) + _ = os.RemoveAll(targetFolderFullPath) } } }