We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent afa7de3 commit fa96b35Copy full SHA for fa96b35
pkg/data/data.go
@@ -22,6 +22,7 @@ import (
22
"encoding/json"
23
"fmt"
24
"hash/crc32"
25
+ "os"
26
"sort"
27
"strings"
28
"text/template"
@@ -151,7 +152,15 @@ type Checksum struct {
151
152
CompactRevision int64
153
}
154
155
+// boltOpen checks if the file exists and opens it in read-only mode.
156
+// Returns an error if the file does not exist.
157
func boltOpen(path string) (*bolt.DB, error) {
158
+ // Check if the file exists
159
+ if _, err := os.Stat(path); os.IsNotExist(err) {
160
+ return nil, fmt.Errorf("file does not exist: %s", path)
161
+ }
162
+
163
+ // Open the file in read-only mode
164
return bolt.Open(path, 0400, &bolt.Options{
165
ReadOnly: true,
166
})
0 commit comments