summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2022-07-16 04:11:13 -0400
committerWill Hawkins <[email protected]>2022-07-16 04:13:21 -0400
commit72c8de6ac0cf85f395ee89db3e8363b2376ec7cd (patch)
tree2c1778dac104a3464d963dfdcafe39ead9e97ff0
parent23d16686f2320f9a5fe35aebbaa2e036b27421ca (diff)
[Formatting] Cleanup long lines.
-rw-r--r--README.md8
-rw-r--r--datalogger/logger.go14
-rw-r--r--networkQuality.go54
-rw-r--r--rpm/rpm.go24
-rw-r--r--utilities/utilities_test.go13
5 files changed, 97 insertions, 16 deletions
diff --git a/README.md b/README.md
index fcaf5bd..04b3339 100644
--- a/README.md
+++ b/README.md
@@ -107,11 +107,11 @@ docker run --rm goresp --config mensura.cdn-apple.com --port 443 --path /api/v1/
## Contributing
-We *love* contributions. Before submitting a patch, format your code with `go fmt`.
+We *love* contributions. Before submitting a patch, first format your code with `go fmt`. Then, run `golines`:
-Normally we would recommend that you format your code using `golines` before submitting, but `golines` does not appear to be compatible with Go's new generic types.
-
-This README.md will be updated when `golines` is patched to support Go's new generic types.
+```
+$ golines -w .
+```
You can easily install `golines` in to your `${GOPATH}` with
diff --git a/datalogger/logger.go b/datalogger/logger.go
index 26717fb..dd071a1 100644
--- a/datalogger/logger.go
+++ b/datalogger/logger.go
@@ -1,3 +1,17 @@
+/*
+ * This file is part of Go Responsiveness.
+ *
+ * Go Responsiveness is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ * Go Responsiveness is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with Go Responsiveness. If not, see <https://www.gnu.org/licenses/>.
+ */
+
package datalogger
import (
diff --git a/networkQuality.go b/networkQuality.go
index e875e97..731f755 100644
--- a/networkQuality.go
+++ b/networkQuality.go
@@ -9,7 +9,7 @@
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
- * with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ * with Go Responsiveness. If not, see <https://www.gnu.org/licenses/>.
*/
package main
@@ -86,7 +86,11 @@ var (
false,
"Enable the collection and display of extended statistics -- may not be available on certain platforms.",
)
- dataLoggerBaseFileName = flag.String("logger-filename", "", "Store information about the results of each probe in files with this basename. Time and probe type will be appended (before the first .) to create two separate log files. Disabled by default.")
+ dataLoggerBaseFileName = flag.String(
+ "logger-filename",
+ "",
+ "Store information about the results of each probe in files with this basename. Time and probe type will be appended (before the first .) to create two separate log files. Disabled by default.",
+ )
)
func main() {
@@ -191,15 +195,26 @@ func main() {
var err error = nil
unique := time.Now().UTC().Format("01-02-2006-15-04-05")
dataLoggerSelfFilename := utilities.FilenameAppend(*dataLoggerBaseFileName, "-self-"+unique)
- dataLoggerForeignFilename := utilities.FilenameAppend(*dataLoggerBaseFileName, "-foreign-"+unique)
+ dataLoggerForeignFilename := utilities.FilenameAppend(
+ *dataLoggerBaseFileName,
+ "-foreign-"+unique,
+ )
selfDataLogger, err = datalogger.CreateCSVDataLogger[rpm.DataPoint](dataLoggerSelfFilename)
if err != nil {
- fmt.Printf("Warning: Could not create the file for storing self probe results (%s). Disabling functionality.\n", dataLoggerSelfFilename)
+ fmt.Printf(
+ "Warning: Could not create the file for storing self probe results (%s). Disabling functionality.\n",
+ dataLoggerSelfFilename,
+ )
selfDataLogger = nil
}
- foreignDataLogger, err = datalogger.CreateCSVDataLogger[rpm.DataPoint](dataLoggerForeignFilename)
+ foreignDataLogger, err = datalogger.CreateCSVDataLogger[rpm.DataPoint](
+ dataLoggerForeignFilename,
+ )
if err != nil {
- fmt.Printf("Warning: Could not create the file for storing foreign probe results (%s). Disabling functionality.\n", dataLoggerForeignFilename)
+ fmt.Printf(
+ "Warning: Could not create the file for storing foreign probe results (%s). Disabling functionality.\n",
+ dataLoggerForeignFilename,
+ )
foreignDataLogger = nil
}
}
@@ -222,11 +237,19 @@ func main() {
}
generateSelfProbeConfiguration := func() rpm.ProbeConfiguration {
- return rpm.ProbeConfiguration{URL: config.Urls.SmallUrl, DataLogger: selfDataLogger, Interval: 100 * time.Millisecond}
+ return rpm.ProbeConfiguration{
+ URL: config.Urls.SmallUrl,
+ DataLogger: selfDataLogger,
+ Interval: 100 * time.Millisecond,
+ }
}
generateForeignProbeConfiguration := func() rpm.ProbeConfiguration {
- return rpm.ProbeConfiguration{URL: config.Urls.SmallUrl, DataLogger: foreignDataLogger, Interval: 100 * time.Millisecond}
+ return rpm.ProbeConfiguration{
+ URL: config.Urls.SmallUrl,
+ DataLogger: foreignDataLogger,
+ Interval: 100 * time.Millisecond,
+ }
}
var downloadDebugging *debug.DebugWithPrefix = debug.NewDebugWithPrefix(debugLevel, "download")
@@ -378,11 +401,20 @@ func main() {
foreignProbeDataPoints := utilities.ChannelToSlice(foreignProbeDataPointsChannel)
totalForeignRoundTrips := len(foreignProbeDataPoints)
- foreignProbeRoundTripTimes := utilities.Fmap(foreignProbeDataPoints, func(dp rpm.DataPoint) float64 { return dp.Duration.Seconds() })
+ foreignProbeRoundTripTimes := utilities.Fmap(
+ foreignProbeDataPoints,
+ func(dp rpm.DataPoint) float64 { return dp.Duration.Seconds() },
+ )
foreignProbeRoundTripTimeP90 := utilities.CalculatePercentile(foreignProbeRoundTripTimes, 90)
- downloadRoundTripTimes := utilities.Fmap(downloadDataCollectionResult.DataPoints, func(dcr rpm.DataPoint) float64 { return dcr.Duration.Seconds() })
- uploadRoundTripTimes := utilities.Fmap(uploadDataCollectionResult.DataPoints, func(dcr rpm.DataPoint) float64 { return dcr.Duration.Seconds() })
+ downloadRoundTripTimes := utilities.Fmap(
+ downloadDataCollectionResult.DataPoints,
+ func(dcr rpm.DataPoint) float64 { return dcr.Duration.Seconds() },
+ )
+ uploadRoundTripTimes := utilities.Fmap(
+ uploadDataCollectionResult.DataPoints,
+ func(dcr rpm.DataPoint) float64 { return dcr.Duration.Seconds() },
+ )
selfProbeRoundTripTimes := append(downloadRoundTripTimes, uploadRoundTripTimes...)
totalSelfRoundTrips := len(selfProbeRoundTripTimes)
selfProbeRoundTripTimeP90 := utilities.CalculatePercentile(selfProbeRoundTripTimes, 90)
diff --git a/rpm/rpm.go b/rpm/rpm.go
index 29c735f..aacefb1 100644
--- a/rpm/rpm.go
+++ b/rpm/rpm.go
@@ -1,3 +1,16 @@
+/*
+ * This file is part of Go Responsiveness.
+ *
+ * Go Responsiveness is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ * Go Responsiveness is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with Go Responsiveness. If not, see <https://www.gnu.org/licenses/>.
+ */
package rpm
import (
@@ -224,7 +237,16 @@ func ForeignProber(
client := &http.Client{Transport: &transport}
probeCount++
- go Probe(proberCtx, &wg, foreignProbeConfiguration.DataLogger, client, foreignProbeConfiguration.URL, Foreign, &points, debugging)
+ go Probe(
+ proberCtx,
+ &wg,
+ foreignProbeConfiguration.DataLogger,
+ client,
+ foreignProbeConfiguration.URL,
+ Foreign,
+ &points,
+ debugging,
+ )
}
if debug.IsDebug(debugging.Level) {
fmt.Printf(
diff --git a/utilities/utilities_test.go b/utilities/utilities_test.go
index 703243c..8abc6b1 100644
--- a/utilities/utilities_test.go
+++ b/utilities/utilities_test.go
@@ -1,3 +1,16 @@
+/*
+ * This file is part of Go Responsiveness.
+ *
+ * Go Responsiveness is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ * Go Responsiveness is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with Go Responsiveness. If not, see <https://www.gnu.org/licenses/>.
+ */
package utilities
import (