refacto: remove duplicate

This commit is contained in:
slashformotion 2025-03-17 16:26:43 +01:00
parent 0b2cfc45c1
commit 844e32a11e
2 changed files with 2 additions and 10 deletions

View File

@ -103,7 +103,7 @@ func runDiagnostic() {
fmt.Println("Glance version: " + buildVersion) fmt.Println("Glance version: " + buildVersion)
fmt.Println("Go version: " + runtime.Version()) fmt.Println("Go version: " + runtime.Version())
fmt.Printf("Platform: %s / %s / %d CPUs\n", runtime.GOOS, runtime.GOARCH, runtime.NumCPU()) fmt.Printf("Platform: %s / %s / %d CPUs\n", runtime.GOOS, runtime.GOARCH, runtime.NumCPU())
fmt.Println("In Docker container: " + boolToString(isRunningInsideDockerContainer(), "yes", "no")) fmt.Println("In Docker container: " + ternary(isRunningInsideDockerContainer(), "yes", "no"))
fmt.Printf("\nChecking network connectivity, this may take up to %d seconds...\n\n", int(httpTestRequestTimeout.Seconds())) fmt.Printf("\nChecking network connectivity, this may take up to %d seconds...\n\n", int(httpTestRequestTimeout.Seconds()))
@ -129,7 +129,7 @@ func runDiagnostic() {
fmt.Printf( fmt.Printf(
"%s %s %s| %dms\n", "%s %s %s| %dms\n",
boolToString(step.err == nil, "✓ Can", "✗ Can't"), ternary(step.err == nil, "✓ Can", "✗ Can't"),
step.name, step.name,
extraInfo, extraInfo,
step.elapsed.Milliseconds(), step.elapsed.Milliseconds(),

View File

@ -119,14 +119,6 @@ func parseRFC3339Time(t string) time.Time {
return parsed return parsed
} }
func boolToString(b bool, trueValue, falseValue string) string {
if b {
return trueValue
}
return falseValue
}
func normalizeVersionFormat(version string) string { func normalizeVersionFormat(version string) string {
version = strings.ToLower(strings.TrimSpace(version)) version = strings.ToLower(strings.TrimSpace(version))