fix(util): Major() behavior for major version (#1393)

This commit is contained in:
MaineK00n
2022-02-15 07:59:29 +09:00
committed by GitHub
parent 07335617d3
commit 5164fb1423
2 changed files with 5 additions and 1 deletions

View File

@@ -176,7 +176,7 @@ func Major(version string) string {
} else {
ver = ss[1]
}
return ver[0:strings.Index(ver, ".")]
return strings.Split(ver, ".")[0]
}
// GetHTTPClient return http.Client

View File

@@ -164,6 +164,10 @@ func Test_major(t *testing.T) {
in: "",
expected: "",
},
{
in: "4",
expected: "4",
},
{
in: "4.1",
expected: "4",