Skip to content

A self-hosted dashboard that puts all your feeds in one place

refacto: remove duplicate

slashformotion844e32a11e7f
diff --git a/internal/glance/diagnose.go b/internal/glance/diagnose.go
index 892aa5f..27d0e19 100644
--- a/internal/glance/diagnose.go
+++ b/internal/glance/diagnose.go
@@ -103,7 +103,7 @@ func runDiagnostic() {
fmt.Println("Glance version: " + buildVersion)
fmt.Println("Go version: " + runtime.Version())
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()))
@@ -129,7 +129,7 @@ func runDiagnostic() {
fmt.Printf(
"%s %s %s| %dms\n",
- boolToString(step.err == nil, "✓ Can", "✗ Can't"),
+ ternary(step.err == nil, "✓ Can", "✗ Can't"),
step.name,
extraInfo,
step.elapsed.Milliseconds(),
diff --git a/internal/glance/utils.go b/internal/glance/utils.go
index 72d5a28..a614bda 100644
--- a/internal/glance/utils.go
+++ b/internal/glance/utils.go
@@ -119,14 +119,6 @@ func parseRFC3339Time(t string) time.Time {
return parsed
}
-func boolToString(b bool, trueValue, falseValue string) string {
- if b {
- return trueValue
- }
-
- return falseValue
-}
-
func normalizeVersionFormat(version string) string {
version = strings.ToLower(strings.TrimSpace(version))