summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pgconf/main.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pgconf/main.go b/pgconf/main.go
index 1b70ecc..d254f42 100644
--- a/pgconf/main.go
+++ b/pgconf/main.go
@@ -37,11 +37,16 @@ func main() {
}
}
+ if len(lines) == 0 {
+ fmt.Printf("No lines found\n")
+ os.Exit(0)
+ }
+
var total float64
for _, l := range lines {
total += l.Avgconf
}
avg := total / float64(len(lines))
- fmt.Printf("%0.2f\n", avg)
+ fmt.Printf("%0.0f\n", avg * 100)
}