PMM-7 fix linters. (#161)

This commit is contained in:
Nurlan Moldomurov 2023-10-26 17:04:37 +03:00 committed by GitHub
parent 82694ff65e
commit fbaa2e9b16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 9 deletions

View File

@ -7,14 +7,15 @@ import (
"bufio"
_ "embed"
"fmt"
"github.com/stretchr/testify/assert"
"io/ioutil"
"net/http"
"os"
"regexp"
"sort"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
//go:embed percona-reference-metrics.txt
@ -34,7 +35,7 @@ func TestReferenceCompatibility(t *testing.T) {
resp, err := client.Do(req)
assert.Nil(t, err)
defer resp.Body.Close()
currentMetricsBytes, err := ioutil.ReadAll(resp.Body)
currentMetricsBytes, err := os.ReadAll(resp.Body)
assert.Nil(t, err)
currentMetrics := toMap(t, string(currentMetricsBytes))

View File

@ -4,7 +4,7 @@ import (
"crypto/sha256"
"database/sql"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@ -87,7 +87,7 @@ func initializePerconaExporters(dsn []string, servers *Servers) (func(), *Export
func (e *Exporter) loadCustomQueries(res MetricResolution, version semver.Version, server *Server) {
if e.userQueriesPath[res] != "" {
fi, err := ioutil.ReadDir(e.userQueriesPath[res])
fi, err := os.ReadDir(e.userQueriesPath[res])
if err != nil {
level.Error(logger).Log("msg", fmt.Sprintf("failed read dir %q for custom query", e.userQueriesPath[res]),
"err", err)
@ -110,7 +110,7 @@ func (e *Exporter) loadCustomQueries(res MetricResolution, version semver.Versio
func (e *Exporter) addCustomQueriesFromFile(path string, version semver.Version, server *Server) {
// Calculate the hashsum of the useQueries
userQueriesData, err := ioutil.ReadFile(path)
userQueriesData, err := os.ReadFile(path)
if err != nil {
level.Error(logger).Log("msg", "Failed to reload user queries:"+path, "err", err)
e.userQueriesError.WithLabelValues(path, "").Set(1)

View File

@ -3,7 +3,7 @@ package percona_tests
import (
"flag"
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"
"testing"
@ -154,7 +154,7 @@ func doTest(iterations int, fileName, argsFile string) (cpu, hwm, data int64, _
}
func getCPUMem(pid int) (hwm, data int64) {
contents, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/status", pid))
contents, err := os.ReadFile(fmt.Sprintf("/proc/%d/status", pid))
if err != nil {
return 0, 0
}
@ -178,7 +178,7 @@ func getCPUMem(pid int) (hwm, data int64) {
}
func getCPUTime(pid int) (total int64) {
contents, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/stat", pid))
contents, err := os.ReadFile(fmt.Sprintf("/proc/%d/stat", pid))
if err != nil {
return
}