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

lightningnetwork / lnd / 11216766535

07 Oct 2024 01:37PM UTC coverage: 57.817% (-1.0%) from 58.817%
11216766535

Pull #9148

github

ProofOfKeags
lnwire: remove kickoff feerate from propose/commit
Pull Request #9148: DynComms [2/n]: lnwire: add authenticated wire messages for Dyn*

571 of 879 new or added lines in 16 files covered. (64.96%)

23253 existing lines in 251 files now uncovered.

99022 of 171268 relevant lines covered (57.82%)

38420.67 hits per line

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

30.3
/build/version.go
1
// Copyright (c) 2013-2017 The btcsuite developers
2
// Copyright (c) 2015-2016 The Decred developers
3
// Heavily inspired by https://github.com/btcsuite/btcd/blob/master/version.go
4
// Copyright (C) 2015-2022 The Lightning Network Developers
5

6
package build
7

8
import (
9
        "fmt"
10
        "runtime/debug"
11
        "strings"
12
)
13

14
var (
15
        // Commit stores the current commit of this build, which includes the
16
        // most recent tag, the number of commits since that tag (if non-zero),
17
        // the commit hash, and a dirty marker. This should be set using the
18
        // -ldflags during compilation.
19
        Commit string
20

21
        // CommitHash stores the current commit hash of this build.
22
        CommitHash string
23

24
        // RawTags contains the raw set of build tags, separated by commas.
25
        RawTags string
26

27
        // GoVersion stores the go version that the executable was compiled
28
        // with.
29
        GoVersion string
30
)
31

32
// semanticAlphabet is the set of characters that are permitted for use in an
33
// AppPreRelease.
34
const semanticAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-."
35

36
// These constants define the application version and follow the semantic
37
// versioning 2.0.0 spec (http://semver.org/).
38
const (
39
        // AppMajor defines the major version of this binary.
40
        AppMajor uint = 0
41

42
        // AppMinor defines the minor version of this binary.
43
        AppMinor uint = 18
44

45
        // AppPatch defines the application patch for this binary.
46
        AppPatch uint = 99
47

48
        // AppPreRelease MUST only contain characters from semanticAlphabet per
49
        // the semantic versioning spec.
50
        AppPreRelease = "beta"
51
)
52

53
func init() {
51✔
54
        // Assert that AppPreRelease is valid according to the semantic
51✔
55
        // versioning guidelines for pre-release version and build metadata
51✔
56
        // strings. In particular it MUST only contain characters in
51✔
57
        // semanticAlphabet.
51✔
58
        for _, r := range AppPreRelease {
255✔
59
                if !strings.ContainsRune(semanticAlphabet, r) {
204✔
60
                        panic(fmt.Errorf("rune: %v is not in the semantic "+
×
61
                                "alphabet", r))
×
62
                }
63
        }
64

65
        // Get build information from the runtime.
66
        if info, ok := debug.ReadBuildInfo(); ok {
102✔
67
                GoVersion = info.GoVersion
51✔
68
                for _, setting := range info.Settings {
51✔
UNCOV
69
                        switch setting.Key {
×
UNCOV
70
                        case "vcs.revision":
×
UNCOV
71
                                CommitHash = setting.Value
×
72

UNCOV
73
                        case "-tags":
×
UNCOV
74
                                RawTags = setting.Value
×
75
                        }
76
                }
77
        }
78
}
79

80
// Version returns the application version as a properly formed string per the
81
// semantic versioning 2.0.0 spec (http://semver.org/).
UNCOV
82
func Version() string {
×
UNCOV
83
        // Start with the major, minor, and patch versions.
×
UNCOV
84
        version := fmt.Sprintf("%d.%d.%d", AppMajor, AppMinor, AppPatch)
×
UNCOV
85

×
UNCOV
86
        // Append pre-release version if there is one. The hyphen called for by
×
UNCOV
87
        // the semantic versioning spec is automatically appended and should not
×
UNCOV
88
        // be contained in the pre-release string.
×
UNCOV
89
        if AppPreRelease != "" {
×
UNCOV
90
                version = fmt.Sprintf("%s-%s", version, AppPreRelease)
×
UNCOV
91
        }
×
92

UNCOV
93
        return version
×
94
}
95

96
// Tags returns the list of build tags that were compiled into the executable.
UNCOV
97
func Tags() []string {
×
UNCOV
98
        if len(RawTags) == 0 {
×
99
                return nil
×
100
        }
×
101

UNCOV
102
        return strings.Split(RawTags, ",")
×
103
}
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