Skip to content

Commit e2b2994

Browse files
authored
fix(nodebuilder/p2p): remove prepended v against detected semantic version (#3547)
1 parent 0e5c61c commit e2b2994

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

nodebuilder/node/buildInfo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (b *BuildInfo) GetSemanticVersion() string {
3232
return emptyValue
3333
}
3434

35-
return fmt.Sprintf("v%s", b.SemanticVersion)
35+
return b.SemanticVersion
3636
}
3737

3838
func (b *BuildInfo) CommitShortSha() string {

nodebuilder/node/buildinfo_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,17 @@ func TestGetSemanticVersion(t *testing.T) {
2929
{
3030
name: "Non-empty Semantic Version",
3131
buildInfo: BuildInfo{
32-
SemanticVersion: "1.2.3",
32+
SemanticVersion: "v1.2.3",
3333
},
3434
expectedVersion: "v1.2.3",
3535
},
36-
// Add more test cases as needed
36+
{
37+
name: "Non-empty Semantic Version without v prefix",
38+
buildInfo: BuildInfo{
39+
SemanticVersion: "1.2.3",
40+
},
41+
expectedVersion: "1.2.3",
42+
},
3743
}
3844

3945
for _, tc := range tests {

nodebuilder/p2p/host_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestUserAgent(t *testing.T) {
2020
tp: node.Full,
2121
expected: "celestia-node/testnet/full/v1.0.0/abcdefg",
2222
build: &node.BuildInfo{
23-
SemanticVersion: "1.0.0",
23+
SemanticVersion: "v1.0.0",
2424
LastCommit: "abcdefg",
2525
},
2626
},
@@ -30,7 +30,7 @@ func TestUserAgent(t *testing.T) {
3030
expected: "celestia-node/mainnet/light/v1.0.0/abcdefg",
3131
tp: node.Light,
3232
build: &node.BuildInfo{
33-
SemanticVersion: "1.0.0",
33+
SemanticVersion: "v1.0.0",
3434
LastCommit: "abcdefg",
3535
},
3636
},

0 commit comments

Comments
 (0)