• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 13586005509

28 Feb 2025 10:14AM UTC coverage: 68.629% (+9.9%) from 58.77%
13586005509

Pull #9521

github

web-flow
Merge 37d3a70a5 into 8532955b3
Pull Request #9521: unit: remove GOACC, use Go 1.20 native coverage functionality

129950 of 189351 relevant lines covered (68.63%)

23726.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/lnutils/fs.go
1
package lnutils
2

3
import (
4
        "errors"
5
        "fmt"
6
        "os"
7
)
8

9
// CreateDir creates a directory if it doesn't exist and also handles
10
// symlink-related errors with user-friendly messages. It creates all necessary
11
// parent directories with the specified permissions.
12
func CreateDir(dir string, perm os.FileMode) error {
4✔
13
        err := os.MkdirAll(dir, perm)
4✔
14
        if err == nil {
6✔
15
                return nil
2✔
16
        }
2✔
17

18
        // Show a nicer error message if it's because a symlink
19
        // is linked to a directory that does not exist
20
        // (probably because it's not mounted).
21
        var pathErr *os.PathError
2✔
22
        if errors.As(err, &pathErr) && os.IsExist(err) {
3✔
23
                link, lerr := os.Readlink(pathErr.Path)
1✔
24
                if lerr == nil {
2✔
25
                        return fmt.Errorf("is symlink %s -> %s "+
1✔
26
                                "mounted?", pathErr.Path, link)
1✔
27
                }
1✔
28
        }
29

30
        return fmt.Errorf("failed to create directory '%s': %w", dir, err)
1✔
31
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc