Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion codersdk/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,12 @@ func DefaultSupportLinks(docsURL string) []LinkConfig {
}
}

func removeTrailingVersionInfo(v string) string {
return strings.Split(strings.Split(v, "-")[0], "+")[0]
}

func DefaultDocsURL() string {
version := strings.Split(buildinfo.Version(), "-")[0]
version := removeTrailingVersionInfo(buildinfo.Version())
if version == "v0.0.0" {
return "https://coder.com/docs"
}
Expand Down
36 changes: 36 additions & 0 deletions codersdk/deployment_internal_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package codersdk

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestRemoveTrailingVersionInfo(t *testing.T) {
t.Parallel()

testCases := []struct {
Version string
ExpectedAfterStrippingInfo string
}{
{
Version: "v2.16.0+683a720",
ExpectedAfterStrippingInfo: "v2.16.0",
},
{
Version: "v2.16.0-devel+683a720",
ExpectedAfterStrippingInfo: "v2.16.0",
},
{
Version: "v2.16.0+683a720-devel",
ExpectedAfterStrippingInfo: "v2.16.0",
},
}

for _, tc := range testCases {
tc := tc

stripped := removeTrailingVersionInfo(tc.Version)
require.Equal(t, tc.ExpectedAfterStrippingInfo, stripped)
}
}
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy