summaryrefslogtreecommitdiff
path: root/utilities/utilities.go
diff options
context:
space:
mode:
Diffstat (limited to 'utilities/utilities.go')
-rw-r--r--utilities/utilities.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/utilities/utilities.go b/utilities/utilities.go
index 538889c..377be56 100644
--- a/utilities/utilities.go
+++ b/utilities/utilities.go
@@ -28,6 +28,11 @@ import (
"golang.org/x/exp/constraints"
)
+var (
+ // GitVersion is the Git revision hash
+ GitVersion = "dev"
+)
+
func Iota(low int, high int) (made []int) {
made = make([]int, high-low)
@@ -46,9 +51,6 @@ func SignedPercentDifference[T constraints.Float | constraints.Integer](
current T,
previous T,
) (difference float64) {
- //return ((current - previous) / (float64(current+previous) / 2.0)) * float64(
- //100,
- // )
fCurrent := float64(current)
fPrevious := float64(previous)
return ((fCurrent - fPrevious) / fPrevious) * 100.0
@@ -180,9 +182,9 @@ func OrTimeout(f func(), timeout time.Duration) {
return completed
}()
select {
- case _ = <-completeChannel:
+ case <-completeChannel:
break
- case _ = <-time.After(timeout):
+ case <-time.After(timeout):
break
}
}
@@ -203,3 +205,7 @@ func ApproximatelyEqual[T float32 | float64](truth T, maybe T, fudge T) bool {
diff := math.Abs((bTruth - bMaybe))
return diff < bFudge
}
+
+func UserAgent() string {
+ return fmt.Sprintf("goresponsiveness/%s", GitVersion)
+}