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

lightningnetwork / lnd / 13598776427

01 Mar 2025 12:18AM UTC coverage: 58.254% (-10.4%) from 68.65%
13598776427

push

github

web-flow
Merge pull request #9565 from guggero/bot-typo-fix-spam

GitHub+docs: no longer accept typo fixes to fight PR spam

94381 of 162016 relevant lines covered (58.25%)

1.81 hits per line

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

0.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 {
×
13
        err := os.MkdirAll(dir, perm)
×
14
        if err == nil {
×
15
                return nil
×
16
        }
×
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
×
22
        if errors.As(err, &pathErr) && os.IsExist(err) {
×
23
                link, lerr := os.Readlink(pathErr.Path)
×
24
                if lerr == nil {
×
25
                        return fmt.Errorf("is symlink %s -> %s "+
×
26
                                "mounted?", pathErr.Path, link)
×
27
                }
×
28
        }
29

30
        return fmt.Errorf("failed to create directory '%s': %w", dir, err)
×
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