Skip to content

Commit 254c042

Browse files
committed
style: add some line breaks
1 parent e3a83c8 commit 254c042

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

internal/cache/artifacts.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func copyFile(src, dst string) error {
7676
if err != nil {
7777
return err
7878
}
79+
7980
defer srcFile.Close()
8081

8182
// Create parent directory if needed
@@ -87,6 +88,7 @@ func copyFile(src, dst string) error {
8788
if err != nil {
8889
return err
8990
}
91+
9092
defer dstFile.Close()
9193

9294
if _, err := io.Copy(dstFile, srcFile); err != nil {

internal/cache/cache.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func New(cacheDir string) (*Cache, error) {
3434
if err != nil {
3535
return nil, fmt.Errorf("failed to get working directory: %w", err)
3636
}
37+
3738
cacheDir = filepath.Join(cwd, DefaultCacheDir)
3839
}
3940

@@ -70,6 +71,7 @@ func (c *Cache) Close() error {
7071
if c.db != nil {
7172
return c.db.Close()
7273
}
74+
7375
return nil
7476
}
7577

@@ -84,6 +86,7 @@ func (c *Cache) Get(sourceFile string, cfg *config.Config) (*Entry, error) {
8486
var entry Entry
8587
err = c.db.View(func(tx *bbolt.Tx) error {
8688
b := tx.Bucket([]byte(bucketName))
89+
8790
data := b.Get([]byte(hash))
8891
if data == nil {
8992
return nil // Cache miss
@@ -130,10 +133,12 @@ func (c *Cache) Store(sourceFile string, cfg *config.Config, outputDir string, s
130133
// Store metadata in BoltDB
131134
err = c.db.Update(func(tx *bbolt.Tx) error {
132135
b := tx.Bucket([]byte(bucketName))
136+
133137
data, err := json.Marshal(entry)
134138
if err != nil {
135139
return err
136140
}
141+
137142
return b.Put([]byte(hash), data)
138143
})
139144
if err != nil {
@@ -196,6 +201,7 @@ func (c *Cache) Stats() (int, int64, error) {
196201

197202
err := c.db.View(func(tx *bbolt.Tx) error {
198203
b := tx.Bucket([]byte(bucketName))
204+
199205
count = b.Stats().KeyN
200206
return nil
201207
})
@@ -209,9 +215,11 @@ func (c *Cache) Stats() (int, int64, error) {
209215
if err != nil {
210216
return nil // Skip errors
211217
}
218+
212219
if !info.IsDir() {
213220
totalSize += info.Size()
214221
}
222+
215223
return nil
216224
})
217225

internal/cache/hash.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func HashSource(sourceFile string, cfg *config.Config) (string, error) {
2626
if err != nil {
2727
return "", fmt.Errorf("failed to open source file: %w", err)
2828
}
29+
2930
defer f.Close()
3031

3132
if _, err := io.Copy(h, f); err != nil {
@@ -54,6 +55,7 @@ func HashFile(path string) (string, error) {
5455
if err != nil {
5556
return "", err
5657
}
58+
5759
defer f.Close()
5860

5961
h := sha256.New()

0 commit comments

Comments
 (0)