Skip to content

Commit 4960dde

Browse files
committed
make linter happy
1 parent ba9008a commit 4960dde

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

cmd/convert_metrics/convert_metrics.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ const (
5555
PresetConfigYAMLFile = "preset-configs.yaml"
5656
)
5757

58-
// VersionToInt parses a given version and returns an integer or
59-
// an error if unable to parse the version. Only parses valid semantic versions.
60-
// Performs checking that can find errors within the version.
61-
// Examples: v1.2 -> 01_02_00, v9.6.3 -> 09_06_03, v11 -> 11_00_00
62-
var regVer = regexp.MustCompile(`(\d+).?(\d*).?(\d*)`)
63-
6458
// expected is following structure: metric_name/pg_ver/metric(_master|standby).sql
6559
func ReadMetricsFromFolder(folder string) (metricsMap Metrics, err error) {
6660
metricFolders, err := os.ReadDir(folder)
@@ -220,10 +214,10 @@ new_helper:
220214
func getArgs(src *string, dst *string) (err error) {
221215
flag.Parse()
222216
if src == nil || *src == "" {
223-
err = errors.New("Error: src option is required")
217+
err = errors.New("-src option is required")
224218
}
225219
if dst == nil || *dst == "" {
226-
err = errors.Join(err, errors.New("Error: dst option is required"))
220+
err = errors.Join(err, errors.New("-dst option is required"))
227221
}
228222
if err != nil {
229223
fmt.Println(err)

cmd/convert_metrics/convert_metrics_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ func downloadAndExtractMetrics(t *testing.T, dest string) string {
5757
rel := strings.TrimPrefix(f.Name, metricsRoot)
5858
if rel == "" {
5959
extracted = filepath.Join(dest, "metrics")
60-
os.MkdirAll(extracted, 0755)
60+
_ = os.MkdirAll(extracted, 0755)
6161
continue
6262
}
6363
path := filepath.Join(dest, "metrics", rel)
6464
if f.FileInfo().IsDir() {
65-
os.MkdirAll(path, 0755)
65+
_ = os.MkdirAll(path, 0755)
6666
} else {
67-
os.MkdirAll(filepath.Dir(path), 0755)
67+
_ = os.MkdirAll(filepath.Dir(path), 0755)
6868
out, err := os.Create(path)
6969
if err != nil {
7070
t.Fatalf("failed to create file: %v", err)
@@ -74,9 +74,9 @@ func downloadAndExtractMetrics(t *testing.T, dest string) string {
7474
out.Close()
7575
t.Fatalf("failed to open file in zip: %v", err)
7676
}
77-
io.Copy(out, rc)
78-
out.Close()
79-
rc.Close()
77+
_, _ = io.Copy(out, rc)
78+
_ = out.Close()
79+
_ = rc.Close()
8080
}
8181
}
8282
}

0 commit comments

Comments
 (0)