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

lightningnetwork / lnd / 13440912774

20 Feb 2025 05:14PM UTC coverage: 57.697% (-1.1%) from 58.802%
13440912774

Pull #9535

github

guggero
GitHub: remove duplicate caching

Turns out that actions/setup-go starting with @v4 also adds caching.
With that, our cache size on disk has almost doubled, leading to the
GitHub runner running out of space in certain situation.
We fix that by disabling the automated caching since we already have our
own, custom-tailored version.
Pull Request #9535: GitHub: remove duplicate caching

103519 of 179417 relevant lines covered (57.7%)

24825.3 hits per line

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

12.5
/watchtower/conf.go
1
package watchtower
2

3
import (
4
        "strconv"
5
        "time"
6
)
7

8
// Conf specifies the watchtower options that can be configured from the command
9
// line or configuration file.
10
type Conf struct {
11
        // RawListeners configures the watchtower's listening ports/interfaces.
12
        RawListeners []string `long:"listen" description:"Add interfaces/ports to listen for peer connections"`
13

14
        // RawExternalIPs configures the watchtower's external ports/interfaces.
15
        RawExternalIPs []string `long:"externalip" description:"Add interfaces/ports where the watchtower can accept peer connections"`
16

17
        // ReadTimeout specifies the duration the tower will wait when trying to
18
        // read a message from a client before hanging up.
19
        ReadTimeout time.Duration `long:"readtimeout" description:"Duration the watchtower server will wait for messages to be received before hanging up on clients"`
20

21
        // WriteTimeout specifies the duration the tower will wait when trying
22
        // to write a message from a client before hanging up.
23
        WriteTimeout time.Duration `long:"writetimeout" description:"Duration the watchtower server will wait for messages to be written before hanging up on client connections"`
24
}
25

26
// DefaultConf returns a Conf with some default values filled in.
27
func DefaultConf() *Conf {
1✔
28
        return &Conf{
1✔
29
                ReadTimeout:  DefaultReadTimeout,
1✔
30
                WriteTimeout: DefaultWriteTimeout,
1✔
31
        }
1✔
32
}
1✔
33

34
// Apply completes the passed Config struct by applying any parsed Conf options.
35
// If the corresponding values parsed by Conf are already set in the Config,
36
// those fields will be not be modified.
37
func (c *Conf) Apply(cfg *Config,
38
        normalizer AddressNormalizer) (*Config, error) {
×
39

×
40
        // Set the Config's listening addresses if they are empty.
×
41
        if cfg.ListenAddrs == nil {
×
42
                // Without a network, we will be unable to resolve the listening
×
43
                // addresses.
×
44
                if cfg.Net == nil {
×
45
                        return nil, ErrNoNetwork
×
46
                }
×
47

48
                // If no addresses are specified by the Config, we will resort
49
                // to the default peer port.
50
                if len(c.RawListeners) == 0 {
×
51
                        addr := DefaultListenAddr
×
52
                        c.RawListeners = append(c.RawListeners, addr)
×
53
                }
×
54

55
                // Normalize the raw listening addresses so that they can be
56
                // used by the brontide listener.
57
                var err error
×
58
                cfg.ListenAddrs, err = normalizer(
×
59
                        c.RawListeners, strconv.Itoa(DefaultPeerPort),
×
60
                        cfg.Net.ResolveTCPAddr,
×
61
                )
×
62
                if err != nil {
×
63
                        return nil, err
×
64
                }
×
65
        }
66

67
        // Set the Config's external ips if they are empty.
68
        if cfg.ExternalIPs == nil {
×
69
                // Without a network, we will be unable to resolve the external
×
70
                // IP addresses.
×
71
                if cfg.Net == nil {
×
72
                        return nil, ErrNoNetwork
×
73
                }
×
74

75
                var err error
×
76
                cfg.ExternalIPs, err = normalizer(
×
77
                        c.RawExternalIPs, strconv.Itoa(DefaultPeerPort),
×
78
                        cfg.Net.ResolveTCPAddr,
×
79
                )
×
80
                if err != nil {
×
81
                        return nil, err
×
82
                }
×
83
        }
84

85
        // If the Config has no read timeout, we will use the parsed Conf
86
        // value.
87
        if cfg.ReadTimeout == 0 && c.ReadTimeout != 0 {
×
88
                cfg.ReadTimeout = c.ReadTimeout
×
89
        }
×
90

91
        // If the Config has no write timeout, we will use the parsed Conf
92
        // value.
93
        if cfg.WriteTimeout == 0 && c.WriteTimeout != 0 {
×
94
                cfg.WriteTimeout = c.WriteTimeout
×
95
        }
×
96

97
        return cfg, nil
×
98
}
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