diff --git a/.circleci/config.yml b/.circleci/config.yml index 2efdaf4b94..6ffe88be84 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ executors: docker: # NOTE: To upgrade the Go version, first push the upgrade to the cross-builder Dockerfile # in the edge repo, then update the version here to match. - - image: quay.io/influxdb/cross-builder:go1.17.8-d52942c853d412a5bbcc92f5d78c7c5126c0730d + - image: quay.io/influxdb/cross-builder:go1.18.1-52b299506343dfbb3f138d8a740bcfd0d97c1888 resource_class: large linux-amd64: machine: diff --git a/annotation.go b/annotation.go index 169b4f3761..7e96987058 100644 --- a/annotation.go +++ b/annotation.go @@ -76,17 +76,17 @@ func stickerSliceToMap(stickers []string) (map[string]string, error) { stickerMap := map[string]string{} for i := range stickers { - sticks := strings.SplitN(stickers[i], "=", 2) - if len(sticks) < 2 { + if stick0, stick1, found := strings.Cut(stickers[i], "="); found { + stickerMap[stick0] = stick1 + } else { return nil, invalidStickerError(stickers[i]) } - stickerMap[sticks[0]] = sticks[1] } return stickerMap, nil } -// Service is the service contract for Annotations +// AnnotationService is the service contract for Annotations type AnnotationService interface { // CreateAnnotations creates annotations. CreateAnnotations(ctx context.Context, orgID platform.ID, create []AnnotationCreate) ([]AnnotationEvent, error) diff --git a/annotations/service_test.go b/annotations/service_test.go index 0f33e67bbe..d957239c51 100644 --- a/annotations/service_test.go +++ b/annotations/service_test.go @@ -1,5 +1,4 @@ //go:build sqlite_json && sqlite_foreign_keys -// +build sqlite_json,sqlite_foreign_keys package annotations diff --git a/authorization/http_server_test.go b/authorization/http_server_test.go index 4ab04b82a6..c2cf01fe74 100644 --- a/authorization/http_server_test.go +++ b/authorization/http_server_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "sort" @@ -188,7 +188,7 @@ func TestService_handlePostAuthorization(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Logf("headers: %v body: %s", res.Header, body) @@ -357,7 +357,7 @@ func TestService_handleGetAuthorization(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Logf("headers: %v body: %s", res.Header, body) @@ -746,7 +746,7 @@ func TestService_handleGetAuthorizations(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetAuthorizations() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -847,7 +847,7 @@ func TestService_handleDeleteAuthorization(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleDeleteAuthorization() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/bolt/bbolt_test.go b/bolt/bbolt_test.go index f7d2ed253c..1ec0f7b957 100644 --- a/bolt/bbolt_test.go +++ b/bolt/bbolt_test.go @@ -3,7 +3,6 @@ package bolt_test import ( "context" "errors" - "io/ioutil" "os" "path/filepath" "testing" @@ -27,7 +26,7 @@ func NewTestClient(t *testing.T) (*bolt.Client, func(), error) { func newTestClient(t *testing.T) (*bolt.Client, func(), error) { c := bolt.NewClient(zaptest.NewLogger(t)) - f, err := ioutil.TempFile("", "influxdata-platform-bolt-") + f, err := os.CreateTemp("", "influxdata-platform-bolt-") if err != nil { return nil, nil, errors.New("unable to open temporary boltdb file") } @@ -44,7 +43,7 @@ func newTestClient(t *testing.T) (*bolt.Client, func(), error) { } func TestClientOpen(t *testing.T) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("unable to create temporary test directory %v", err) } @@ -70,7 +69,7 @@ func TestClientOpen(t *testing.T) { } func NewTestKVStore(t *testing.T) (*bolt.KVStore, func(), error) { - f, err := ioutil.TempFile("", "influxdata-platform-bolt-") + f, err := os.CreateTemp("", "influxdata-platform-bolt-") if err != nil { return nil, nil, errors.New("unable to open temporary boltdb file") } diff --git a/cmd/influxd/inspect/dump_tsm/dump_tsm.go b/cmd/influxd/inspect/dump_tsm/dump_tsm.go index 16f6d37ae9..55377d9c2b 100644 --- a/cmd/influxd/inspect/dump_tsm/dump_tsm.go +++ b/cmd/influxd/inspect/dump_tsm/dump_tsm.go @@ -186,13 +186,7 @@ func dumpIndex(cmd *cobra.Command, args args, info dumpIndexParams) { key, _ := info.r.KeyAt(i) for _, e := range info.r.Entries(key) { pos++ - split := strings.Split(string(key), "#!~#") - - measurement := split[0] - var field string - if len(split) > 1 { - field = split[1] - } + measurement, field, _ := strings.Cut(string(key), "#!~#") if args.filterKey != "" && !strings.Contains(string(key), args.filterKey) { continue diff --git a/cmd/influxd/inspect/report_tsm/report_tsm.go b/cmd/influxd/inspect/report_tsm/report_tsm.go index fefcdf5f98..9aacf202dd 100644 --- a/cmd/influxd/inspect/report_tsm/report_tsm.go +++ b/cmd/influxd/inspect/report_tsm/report_tsm.go @@ -1,6 +1,7 @@ package report_tsm import ( + "bytes" "errors" "fmt" "math" @@ -147,8 +148,7 @@ func (a *args) Run(cmd *cobra.Command) error { dbCount.Add(key) if a.detailed { - sep := strings.Index(string(key), "#!~#") - seriesKey, field := key[:sep], key[sep+4:] + seriesKey, field, _ := bytes.Cut(key, []byte("#!~#")) measurement, tags := models.ParseKey(seriesKey) measCount, ok := measCardinalities[measurement] diff --git a/cmd/influxd/launcher/backup_restore_test.go b/cmd/influxd/launcher/backup_restore_test.go index 7c3c65ac1f..bb33d3927e 100644 --- a/cmd/influxd/launcher/backup_restore_test.go +++ b/cmd/influxd/launcher/backup_restore_test.go @@ -2,7 +2,6 @@ package launcher_test import ( "context" - "io/ioutil" "os" "testing" @@ -19,7 +18,7 @@ func TestBackupRestore_Full(t *testing.T) { t.Parallel() ctx := context.Background() - backupDir, err := ioutil.TempDir("", "") + backupDir, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(backupDir) @@ -117,7 +116,7 @@ func TestBackupRestore_Partial(t *testing.T) { t.Parallel() ctx := context.Background() - backupDir, err := ioutil.TempDir("", "") + backupDir, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(backupDir) diff --git a/cmd/influxd/launcher/engine.go b/cmd/influxd/launcher/engine.go index aa371fb571..f6fca802c0 100644 --- a/cmd/influxd/launcher/engine.go +++ b/cmd/influxd/launcher/engine.go @@ -3,7 +3,6 @@ package launcher import ( "context" "io" - "io/ioutil" "os" "sync" "time" @@ -78,7 +77,7 @@ func (t *TemporaryEngine) Open(ctx context.Context) error { return nil } - path, err := ioutil.TempDir("", "e2e") + path, err := os.MkdirTemp("", "e2e") if err != nil { return err } diff --git a/cmd/influxd/launcher/launcher_helpers.go b/cmd/influxd/launcher/launcher_helpers.go index 20fbff3821..3cb48ee830 100644 --- a/cmd/influxd/launcher/launcher_helpers.go +++ b/cmd/influxd/launcher/launcher_helpers.go @@ -4,7 +4,7 @@ import ( "bytes" "context" "fmt" - "io/ioutil" + "io" nethttp "net/http" "net/url" "os" @@ -83,7 +83,7 @@ func RunAndSetupNewLauncherOrFail(ctx context.Context, tb testing.TB, setters .. func NewTestLauncher() *TestLauncher { l := &TestLauncher{Launcher: NewLauncher()} - path, err := ioutil.TempDir("", "") + path, err := os.MkdirTemp("", "") if err != nil { panic(err) } @@ -216,7 +216,7 @@ func (tl *TestLauncher) WriteOrFail(tb testing.TB, to *influxdb.OnboardingResult tb.Fatal(err) } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { tb.Fatal(err) } @@ -242,7 +242,7 @@ func (tl *TestLauncher) WritePoints(data string) error { if err != nil { return err } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return err } diff --git a/cmd/influxd/launcher/launcher_test.go b/cmd/influxd/launcher/launcher_test.go index 2ddcfa1d1e..1db0c0972d 100644 --- a/cmd/influxd/launcher/launcher_test.go +++ b/cmd/influxd/launcher/launcher_test.go @@ -3,7 +3,7 @@ package launcher_test import ( "context" "encoding/json" - "io/ioutil" + "io" nethttp "net/http" "testing" "time" @@ -66,7 +66,7 @@ func TestLauncher_SetupWithUsers(t *testing.T) { t.Fatal(err) } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -96,7 +96,7 @@ func TestLauncher_SetupWithUsers(t *testing.T) { t.Fatal(err) } - body, err = ioutil.ReadAll(resp.Body) + body, err = io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -120,7 +120,7 @@ func TestLauncher_SetupWithUsers(t *testing.T) { t.Fatal(err) } - body, err = ioutil.ReadAll(resp.Body) + body, err = io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } diff --git a/cmd/influxd/launcher/pkger_test.go b/cmd/influxd/launcher/pkger_test.go index 23dd1ef2da..0d42acdd8a 100644 --- a/cmd/influxd/launcher/pkger_test.go +++ b/cmd/influxd/launcher/pkger_test.go @@ -4,9 +4,9 @@ import ( "context" "errors" "fmt" - "io/ioutil" nethttp "net/http" "net/http/httptest" + "os" "runtime" "sort" "strings" @@ -658,7 +658,7 @@ func TestLauncher_Pkger(t *testing.T) { })) defer svr.Close() - f, err := ioutil.TempFile("", "pkg.yml") + f, err := os.CreateTemp("", "pkg.yml") require.NoError(t, err) defer f.Close() diff --git a/cmd/influxd/launcher/query_test.go b/cmd/influxd/launcher/query_test.go index 4846cc4d5d..d1b563c8df 100644 --- a/cmd/influxd/launcher/query_test.go +++ b/cmd/influxd/launcher/query_test.go @@ -8,7 +8,6 @@ import ( "fmt" "html/template" "io" - "io/ioutil" "math/rand" nethttp "net/http" "strings" @@ -986,7 +985,7 @@ error2","query plan",109,110 t.Error(err) } else { dec := csv.NewMultiResultDecoder(csv.ResultDecoderConfig{}) - want, err := dec.Decode(ioutil.NopCloser(strings.NewReader(tc.want))) + want, err := dec.Decode(io.NopCloser(strings.NewReader(tc.want))) if err != nil { t.Fatal(err) } @@ -2591,7 +2590,7 @@ from(bucket: v.bucket) defer got.Release() dec := csv.NewMultiResultDecoder(csv.ResultDecoderConfig{}) - want, err := dec.Decode(ioutil.NopCloser(strings.NewReader(tc.want))) + want, err := dec.Decode(io.NopCloser(strings.NewReader(tc.want))) if err != nil { t.Fatal(err) } diff --git a/cmd/influxd/launcher/storage_test.go b/cmd/influxd/launcher/storage_test.go index ce519bd469..07aed8cf8b 100644 --- a/cmd/influxd/launcher/storage_test.go +++ b/cmd/influxd/launcher/storage_test.go @@ -3,7 +3,7 @@ package launcher_test import ( "context" "fmt" - "io/ioutil" + "io" nethttp "net/http" "strings" "testing" @@ -121,7 +121,7 @@ func TestLauncher_WriteAndQuery(t *testing.T) { t.Fatal(err) } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -158,7 +158,7 @@ func TestLauncher_BucketDelete(t *testing.T) { t.Fatal(err) } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -195,7 +195,7 @@ func TestLauncher_BucketDelete(t *testing.T) { t.Fatal(err) } - if body, err = ioutil.ReadAll(resp.Body); err != nil { + if body, err = io.ReadAll(resp.Body); err != nil { t.Fatal(err) } diff --git a/cmd/influxd/upgrade/config.go b/cmd/influxd/upgrade/config.go index 3261ad06df..abedd66a7f 100644 --- a/cmd/influxd/upgrade/config.go +++ b/cmd/influxd/upgrade/config.go @@ -5,7 +5,6 @@ package upgrade import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -76,7 +75,7 @@ func loadV1Config(configFile string) (*configV1, *map[string]interface{}, error) } func load(path string) ([]byte, error) { - bs, err := ioutil.ReadFile(path) + bs, err := os.ReadFile(path) if err != nil { return nil, err } @@ -193,11 +192,7 @@ func fixQueryLimits(v2Config map[string]interface{}) { func (cu *configUpgrader) lookup(v1Config map[string]interface{}, path string) (interface{}, bool) { for { - elem := path - rest := "" - if i := strings.Index(path, "."); i != -1 { - elem, rest = path[0:i], path[i+1:] - } + elem, rest, _ := strings.Cut(path, ".") val, ok := v1Config[elem] if rest == "" { return val, ok diff --git a/cmd/influxd/upgrade/config_test.go b/cmd/influxd/upgrade/config_test.go index 0ee6f8b5bd..8168db6286 100644 --- a/cmd/influxd/upgrade/config_test.go +++ b/cmd/influxd/upgrade/config_test.go @@ -1,7 +1,7 @@ package upgrade import ( - "io/ioutil" + "os" "path/filepath" "testing" @@ -54,7 +54,7 @@ func TestConfigUpgrade(t *testing.T) { tmpdir := t.TempDir() configFile := filepath.Join(tmpdir, "influxdb.conf") configFileV2 := filepath.Join(filepath.Dir(configFile), "config.toml") - err := ioutil.WriteFile(configFile, []byte(tc.config1x), 0444) + err := os.WriteFile(configFile, []byte(tc.config1x), 0444) require.NoError(t, err) targetOtions := optionsV2{ @@ -127,7 +127,7 @@ func TestConfigLoadFile(t *testing.T) { t.Parallel() tmpdir := t.TempDir() configFile := filepath.Join(tmpdir, "influxdb.conf") - err := ioutil.WriteFile(configFile, []byte(tc.config1x), 0444) + err := os.WriteFile(configFile, []byte(tc.config1x), 0444) require.NoError(t, err) retval, _, err := loadV1Config(configFile) require.NoError(t, err) diff --git a/cmd/influxd/upgrade/fs.go b/cmd/influxd/upgrade/fs.go index 57379a5a31..bca9448e6e 100644 --- a/cmd/influxd/upgrade/fs.go +++ b/cmd/influxd/upgrade/fs.go @@ -3,7 +3,6 @@ package upgrade import ( "fmt" "io" - "io/ioutil" "os" "path/filepath" ) @@ -102,7 +101,7 @@ func CopyDir(src string, dst string, dirRenameFunc func(path string) string, dir return } - entries, err := ioutil.ReadDir(src) + entries, err := os.ReadDir(src) if err != nil { return } @@ -122,7 +121,7 @@ func CopyDir(src string, dst string, dirRenameFunc func(path string) string, dir } } else { // Skip symlinks. - if entry.Mode()&os.ModeSymlink != 0 { + if entry.Type().Perm()&os.ModeSymlink != 0 { continue } if fileFilterFunc != nil && fileFilterFunc(src) { diff --git a/cmd/influxd/upgrade/fs_test.go b/cmd/influxd/upgrade/fs_test.go index 45dfaf8792..be2c779460 100644 --- a/cmd/influxd/upgrade/fs_test.go +++ b/cmd/influxd/upgrade/fs_test.go @@ -2,7 +2,6 @@ package upgrade import ( "bytes" - "io/ioutil" "math/rand" "os" "path/filepath" @@ -13,7 +12,7 @@ import ( ) func TestCopyDirAndDirSize(t *testing.T) { - tmpdir, err := ioutil.TempDir("", "tcd") + tmpdir, err := os.MkdirTemp("", "tcd") if err != nil { t.Fatal(err) } @@ -50,7 +49,7 @@ func TestCopyDirAndDirSize(t *testing.T) { } assert.Equal(t, uint64(1600), size) - targetDir, err := ioutil.TempDir("", "tcd") + targetDir, err := os.MkdirTemp("", "tcd") if err != nil { t.Fatal(err) } diff --git a/cmd/influxd/upgrade/logging_unix.go b/cmd/influxd/upgrade/logging_unix.go index 87a43eef27..adafcd58c4 100644 --- a/cmd/influxd/upgrade/logging_unix.go +++ b/cmd/influxd/upgrade/logging_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package upgrade diff --git a/cmd/influxd/upgrade/upgrade.go b/cmd/influxd/upgrade/upgrade.go index aabf7f694e..aa4526feee 100644 --- a/cmd/influxd/upgrade/upgrade.go +++ b/cmd/influxd/upgrade/upgrade.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "io/ioutil" "net/url" "os" "os/user" @@ -535,7 +534,7 @@ func (o *optionsV2) validatePaths() error { if !fi.IsDir() { return fmt.Errorf("upgraded 2.x engine path %q is not a directory", o.enginePath) } - entries, err := ioutil.ReadDir(o.enginePath) + entries, err := os.ReadDir(o.enginePath) if err != nil { return fmt.Errorf("error checking contents of existing engine directory %q: %w", o.enginePath, err) } diff --git a/cmd/influxd/upgrade/upgrade_test.go b/cmd/influxd/upgrade/upgrade_test.go index b5e79bdb20..b9c50aeea4 100644 --- a/cmd/influxd/upgrade/upgrade_test.go +++ b/cmd/influxd/upgrade/upgrade_test.go @@ -3,7 +3,7 @@ package upgrade import ( "context" "fmt" - "io/ioutil" + "io" "net/http" "os" "path/filepath" @@ -29,7 +29,7 @@ import ( ) func TestPathValidations(t *testing.T) { - tmpdir, err := ioutil.TempDir("", "") + tmpdir, err := os.MkdirTemp("", "") require.Nil(t, err) defer os.RemoveAll(tmpdir) @@ -67,7 +67,7 @@ func TestPathValidations(t *testing.T) { require.NotNil(t, err, "Must fail") require.Contains(t, err.Error(), "1.x meta.db") - err = ioutil.WriteFile(filepath.Join(v1Dir, "meta", "meta.db"), []byte{1}, 0777) + err = os.WriteFile(filepath.Join(v1Dir, "meta", "meta.db"), []byte{1}, 0777) require.Nil(t, err) err = sourceOpts.validatePaths() @@ -80,7 +80,7 @@ func TestPathValidations(t *testing.T) { err = os.Remove(filepath.Join(enginePath, "db")) require.Nil(t, err) - err = ioutil.WriteFile(configsPath, []byte{1}, 0777) + err = os.WriteFile(configsPath, []byte{1}, 0777) require.Nil(t, err) err = targetOpts.validatePaths() @@ -89,7 +89,7 @@ func TestPathValidations(t *testing.T) { } func TestClearTargetPaths(t *testing.T) { - tmpdir, err := ioutil.TempDir("", "") + tmpdir, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(tmpdir) @@ -103,13 +103,13 @@ func TestClearTargetPaths(t *testing.T) { err = os.MkdirAll(filepath.Join(enginePath, "db"), 0777) require.NoError(t, err) - err = ioutil.WriteFile(boltPath, []byte{1}, 0777) + err = os.WriteFile(boltPath, []byte{1}, 0777) require.NoError(t, err) - err = ioutil.WriteFile(configsPath, []byte{1}, 0777) + err = os.WriteFile(configsPath, []byte{1}, 0777) require.NoError(t, err) - err = ioutil.WriteFile(cqPath, []byte{1}, 0777) + err = os.WriteFile(cqPath, []byte{1}, 0777) require.NoError(t, err) - err = ioutil.WriteFile(configPath, []byte{1}, 0777) + err = os.WriteFile(configPath, []byte{1}, 0777) require.NoError(t, err) targetOpts := &optionsV2{ @@ -176,7 +176,7 @@ func TestDbURL(t *testing.T) { func TestUpgradeRealDB(t *testing.T) { ctx := context.Background() - tmpdir, err := ioutil.TempDir("", "") + tmpdir, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(tmpdir) @@ -336,7 +336,7 @@ func TestUpgradeRealDB(t *testing.T) { respBody = mustRunQuery(t, tl, "mydb", `select count(line) from mydb."1week".log`, auths[0].Token) require.Contains(t, respBody, `["1970-01-01T00:00:00Z",1]`) - cqBytes, err := ioutil.ReadFile(cqPath) + cqBytes, err := os.ReadFile(cqPath) require.NoError(t, err) cqs := string(cqBytes) @@ -365,7 +365,7 @@ func mustRunQuery(t *testing.T, tl *launcher.TestLauncher, db, rawQ, token strin resp, err := http.DefaultClient.Do(req) require.Nil(t, err) - respBody, err := ioutil.ReadAll(resp.Body) + respBody, err := io.ReadAll(resp.Body) require.Nil(t, err) return string(respBody) diff --git a/dashboards/transport/http_test.go b/dashboards/transport/http_test.go index 245ab64774..50eb7fce21 100644 --- a/dashboards/transport/http_test.go +++ b/dashboards/transport/http_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "strconv" @@ -380,7 +380,7 @@ func TestService_handleGetDashboards(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetDashboards() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -811,7 +811,7 @@ func TestService_handleGetDashboard(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetDashboard() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) } @@ -1075,7 +1075,7 @@ func TestService_handlePostDashboard(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePostDashboard() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -1174,7 +1174,7 @@ func TestService_handleDeleteDashboard(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleDeleteDashboard() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -1365,7 +1365,7 @@ func TestService_handlePatchDashboard(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePatchDashboard() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -1536,7 +1536,7 @@ func TestService_handlePostDashboardCell(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePostDashboardCell() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -1618,7 +1618,7 @@ func TestService_handleDeleteDashboardCell(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleDeleteDashboardCell() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -1746,7 +1746,7 @@ func TestService_handlePatchDashboardCell(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePatchDashboardCell() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -1925,7 +1925,7 @@ func TestService_handlePostDashboardLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("got %v, want %v", res.StatusCode, tt.wants.statusCode) diff --git a/dbrp/http_server_dbrp_test.go b/dbrp/http_server_dbrp_test.go index 38fe1f49e6..8abba254dc 100644 --- a/dbrp/http_server_dbrp_test.go +++ b/dbrp/http_server_dbrp_test.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "io" - "io/ioutil" "net/http" "net/http/httptest" "strings" @@ -142,7 +141,7 @@ func Test_handlePostDBRP(t *testing.T) { defer resp.Body.Close() if tt.ExpectedErr != nil { - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -284,7 +283,7 @@ func Test_handleGetDBRPs(t *testing.T) { defer resp.Body.Close() if tt.ExpectedErr != nil { - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -412,7 +411,7 @@ func Test_handlePatchDBRP(t *testing.T) { defer resp.Body.Close() if tt.ExpectedErr != nil { - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -505,7 +504,7 @@ func Test_handleDeleteDBRP(t *testing.T) { defer resp.Body.Close() if tt.ExpectedErr != nil { - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } diff --git a/flux/client.go b/flux/client.go index 94f0636fa4..ab392ec0ff 100644 --- a/flux/client.go +++ b/flux/client.go @@ -4,7 +4,7 @@ import ( "context" "crypto/tls" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "time" @@ -72,7 +72,7 @@ func (c *Client) ping(u *url.URL) error { } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return err } diff --git a/go.mod b/go.mod index 5ea79dadaa..8812a7bfd0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/influxdata/influxdb/v2 -go 1.17 +go 1.18 require ( github.com/BurntSushi/toml v0.4.1 @@ -8,18 +8,16 @@ require ( github.com/NYTimes/gziphandler v1.0.1 github.com/RoaringBitmap/roaring v0.4.16 github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 + github.com/apache/arrow/go/v7 v7.0.0 github.com/benbjohnson/clock v0.0.0-20161215174838-7dc76406b6d3 github.com/benbjohnson/tmpl v1.0.0 github.com/buger/jsonparser v0.0.0-20191004114745-ee4c978eae7e github.com/cespare/xxhash v1.1.0 github.com/davecgh/go-spew v1.1.1 github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8 - github.com/docker/docker v1.13.1 // indirect github.com/dustin/go-humanize v1.0.0 github.com/editorconfig-checker/editorconfig-checker v0.0.0-20190819115812-1474bdeaf2a2 - github.com/elazarl/go-bindata-assetfs v1.0.0 - github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 // indirect - github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493 // indirect + github.com/elazarl/go-bindata-assetfs v1.0.1 github.com/go-chi/chi v4.1.0+incompatible github.com/go-stack/stack v1.8.0 github.com/golang-jwt/jwt v3.2.1+incompatible @@ -29,12 +27,11 @@ require ( github.com/google/btree v1.0.1 github.com/google/go-cmp v0.5.7 github.com/google/go-jsonnet v0.17.0 - github.com/hashicorp/go-retryablehttp v0.6.4 // indirect github.com/hashicorp/vault/api v1.0.2 - github.com/imdario/mergo v0.3.9 // indirect github.com/influxdata/cron v0.0.0-20201006132531-4bb0a200dcbe github.com/influxdata/flux v0.164.0 github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69 + github.com/influxdata/influx-cli/v2 v2.2.1-0.20220318222112-88ba3464cd07 github.com/influxdata/influxql v1.1.1-0.20211004132434-7e7d61973256 github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 github.com/influxdata/pkg-config v0.2.11 @@ -47,17 +44,12 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.1 github.com/mileusna/useragent v0.0.0-20190129205925-3e331f0949a5 github.com/mna/pigeon v1.0.1-0.20180808201053-bb0192cfc2ae - github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae // indirect - github.com/onsi/ginkgo v1.11.0 // indirect - github.com/onsi/gomega v1.8.1 // indirect github.com/opentracing/opentracing-go v1.2.0 - github.com/philhofer/fwd v1.0.0 // indirect github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.5.1 github.com/prometheus/client_model v0.2.0 github.com/prometheus/common v0.9.1 github.com/retailnext/hllpp v1.0.0 - github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect github.com/spf13/cast v1.3.0 github.com/spf13/cobra v1.0.0 github.com/spf13/pflag v1.0.5 @@ -66,17 +58,14 @@ require ( github.com/testcontainers/testcontainers-go v0.0.0-20190108154635-47c0da630f72 github.com/tinylib/msgp v1.1.0 github.com/uber/jaeger-client-go v2.28.0+incompatible - github.com/willf/bitset v1.1.9 // indirect github.com/xlab/treeprint v1.0.0 github.com/yudai/gojsondiff v1.0.0 - github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect - github.com/yudai/pp v2.0.1+incompatible // indirect go.etcd.io/bbolt v1.3.6 go.uber.org/multierr v1.6.0 go.uber.org/zap v1.16.0 - golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 + golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e + golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 golang.org/x/text v0.3.7 golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a @@ -86,11 +75,6 @@ require ( honnef.co/go/tools v0.3.0 ) -require ( - github.com/apache/arrow/go/v7 v7.0.0 - github.com/influxdata/influx-cli/v2 v2.2.1-0.20220318222112-88ba3464cd07 -) - require ( cloud.google.com/go v0.82.0 // indirect cloud.google.com/go/bigquery v1.8.0 // indirect @@ -133,6 +117,7 @@ require ( github.com/denisenkom/go-mssqldb v0.10.0 // indirect github.com/dimchansky/utfbom v1.1.0 // indirect github.com/docker/distribution v2.7.0+incompatible // indirect + github.com/docker/docker v1.13.1 // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.3.3 // indirect github.com/eclipse/paho.mqtt.golang v1.2.0 // indirect @@ -140,6 +125,8 @@ require ( github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect github.com/fsnotify/fsnotify v1.4.7 // indirect github.com/gabriel-vasile/mimetype v1.4.0 // indirect + github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 // indirect + github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493 // indirect github.com/go-sql-driver/mysql v1.5.0 // indirect github.com/goccy/go-json v0.7.10 // indirect github.com/gofrs/uuid v3.3.0+incompatible // indirect @@ -154,11 +141,13 @@ require ( github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.1 // indirect github.com/hashicorp/go-multierror v1.0.0 // indirect + github.com/hashicorp/go-retryablehttp v0.6.4 // indirect github.com/hashicorp/go-rootcerts v1.0.0 // indirect github.com/hashicorp/go-sockaddr v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/vault/sdk v0.1.8 // indirect github.com/huandu/xstrings v1.0.0 // indirect + github.com/imdario/mergo v0.3.9 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/influxdata/gosnowflake v1.6.9 // indirect github.com/influxdata/influxdb-client-go/v2 v2.3.1-0.20210518120617-5d1fff431040 // indirect @@ -177,14 +166,19 @@ require ( github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.1.2 // indirect + github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae // indirect + github.com/onsi/ginkgo v1.11.0 // indirect + github.com/onsi/gomega v1.8.1 // indirect github.com/opencontainers/go-digest v1.0.0-rc1 // indirect github.com/pelletier/go-toml v1.2.0 // indirect + github.com/philhofer/fwd v1.0.0 // indirect github.com/pierrec/lz4 v2.0.5+incompatible // indirect github.com/pierrec/lz4/v4 v4.1.11 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/procfs v0.0.8 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect + github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect github.com/segmentio/kafka-go v0.1.0 // indirect github.com/sergi/go-diff v1.1.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect @@ -196,12 +190,15 @@ require ( github.com/uber/athenadriver v1.1.4 // indirect github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/vertica/vertica-sql-go v1.1.1 // indirect + github.com/willf/bitset v1.1.9 // indirect + github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect + github.com/yudai/pp v2.0.1+incompatible // indirect go.opencensus.io v0.23.0 // indirect go.uber.org/atomic v1.7.0 // indirect golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect - golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect + golang.org/x/net v0.0.0-20220401154927-543a649e0bdd // indirect golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect diff --git a/go.sum b/go.sum index 32eb3f7026..82bdafffc5 100644 --- a/go.sum +++ b/go.sum @@ -78,10 +78,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/DATA-DOG/go-sqlmock v1.4.1 h1:ThlnYciV1iM/V0OSF/dtkqWb6xo5qITT1TJBG1MRDJM= github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/HdrHistogram/hdrhistogram-go v1.1.0 h1:6dpdDPTRoo78HxAJ6T1HfMiKSnqhgRRqzCuPshRkQ7I= -github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/MakeNowJust/heredoc/v2 v2.0.1/go.mod h1:6/2Abh5s+hc3g9nbWLe9ObDIOhaRrqsyY9MWy+4JdRM= github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/sprig v2.16.0+incompatible h1:QZbMUPxRQ50EKAq3LFMnxddMu88/EUUG3qmxwtDmPsY= @@ -182,7 +180,6 @@ github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl github.com/buger/jsonparser v0.0.0-20191004114745-ee4c978eae7e h1:oJCXMss/3rg5F6Poy9wG3JQusc58Mzk5B9Z6wSnssNE= github.com/buger/jsonparser v0.0.0-20191004114745-ee4c978eae7e/go.mod h1:errmMKH8tTB49UR2A8C8DPYkyudelsYJwJFaZHQ6ik8= github.com/c-bata/go-prompt v0.2.2 h1:uyKRz6Z6DUyj49QVijyM339UJV9yhbr70gESwbNU3e0= -github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/cactus/go-statsd-client/statsd v0.0.0-20191106001114-12b4e2b38748/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -218,8 +215,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= -github.com/daixiang0/gci v0.2.8/go.mod h1:+4dZ7TISfSmqfAGv59ePaHfNzgGtIkHAhhdKggP1JAc= -github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -256,8 +251,8 @@ github.com/editorconfig-checker/editorconfig-checker v0.0.0-20190819115812-1474b github.com/editorconfig/editorconfig-core-go/v2 v2.1.1 h1:mhPg/0hGebcpiiQLqJD2PWWyoHRLEdZ3sXKaEvT1EQU= github.com/editorconfig/editorconfig-core-go/v2 v2.1.1/go.mod h1:/LuhWJiQ9Gvo1DhVpa4ssm5qeg8rrztdtI7j/iCie2k= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw= +github.com/elazarl/go-bindata-assetfs v1.0.1/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -277,12 +272,10 @@ github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoD github.com/form3tech-oss/jwt-go v3.2.5+incompatible h1:/l4kBbb4/vGSsdtB5nUe8L7B9mImVMaBPw9L/0TBHU8= github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/foxcpp/go-mockdns v0.0.0-20201212160233-ede2f9158d15 h1:nLPjjvpUAODOR6vY/7o0hBIk8iTr19Fvmf8aFx/kC7A= -github.com/foxcpp/go-mockdns v0.0.0-20201212160233-ede2f9158d15/go.mod h1:tPg4cp4nseejPd+UKxtCVQ2hUxNTZ7qQZJa7CLriIeo= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fujiwara/shapeio v1.0.0/go.mod h1:LmEmu6L/8jetyj1oewewFb7bZCNRwE7wLCUNzDLaLVA= github.com/gabriel-vasile/mimetype v1.4.0 h1:Cn9dkdYsMIu56tGho+fqzh7XmvY2YyGU0FnbhiOsEro= github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= @@ -318,7 +311,6 @@ github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/gocarina/gocsv v0.0.0-20210408192840-02d7211d929d/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI= github.com/goccy/go-json v0.7.10 h1:ulhbuNe1JqE68nMRXXTJRrUu0uhouf0VevLINxQq4Ec= github.com/goccy/go-json v0.7.10/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gofrs/uuid v3.3.0+incompatible h1:8K4tyRfvU1CYPgJsveYFQMhpFd/wXNM7iK6rR7UHz84= @@ -521,7 +513,6 @@ github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7 github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= github.com/influxdata/pkg-config v0.2.11 h1:RDlWAvkTARzPRGChq34x179TYlRndq8OU5Ro80E9g3Q= github.com/influxdata/pkg-config v0.2.11/go.mod h1:EMS7Ll0S4qkzDk53XS3Z72/egBsPInt+BeRxb0WeSwk= -github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= github.com/influxdata/tdigest v0.0.2-0.20210216194612-fc98d27c9e8b h1:i44CesU68ZBRvtCjBi3QSosCIKrjmMbYlQMFAwVLds4= github.com/influxdata/tdigest v0.0.2-0.20210216194612-fc98d27c9e8b/go.mod h1:Z0kXnxzbTC2qrx4NaIzYkE1k66+6oEDQTvL95hQFh5Y= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -577,7 +568,6 @@ github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= @@ -606,22 +596,17 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA= github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA= github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104 h1:d8RFOZ2IiFtFWBcKEHAFYJcPTf0wY5q0exFNJZVWa1U= -github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.22 h1:Jm64b3bO9kP43ddLjL2EY3Io6bmy1qGb9Xxz6TqS6rc= -github.com/miekg/dns v1.1.22/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/mileusna/useragent v0.0.0-20190129205925-3e331f0949a5 h1:pXqZHmHOz6LN+zbbUgqyGgAWRnnZEI40IzG3tMsXcSI= github.com/mileusna/useragent v0.0.0-20190129205925-3e331f0949a5/go.mod h1:JWhYAp2EXqUtsxTKdeGlY8Wp44M7VxThC9FEoNGi2IE= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= @@ -656,12 +641,10 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw= @@ -709,7 +692,6 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5 h1:tFwafIEMf0B7NlcxV/zJ6leBIa81D3hgGSgsE5hCkOQ= -github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -731,7 +713,6 @@ github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7q github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= @@ -763,7 +744,6 @@ github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrY github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/segmentio/kafka-go v0.1.0 h1:IXCHG+sXPNiIR5pC/vTEItZduPKu4cnpr85YgxpxlW0= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -831,7 +811,6 @@ github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6 github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= @@ -854,7 +833,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zeebo/xxh3 v0.13.0/go.mod h1:AQY73TOrhF3jNsdiM9zZOb8MThrYbZONHj7ryDBaLpg= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -906,15 +884,14 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 h1:/pEO3GD/ABYAjuakUS6xSEmmlyVS4kxBNkeA9tLJiTI= golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 h1:tkVvjkPTB7pnW3jnid7kNyAMPVWllTNOf/qKDze4p9o= +golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -932,7 +909,6 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20211028214138-64b4c8e87d1a/go.mod h1:a3o/VtDNHN+dCVLEpzjjUHOzR+Ln3DHX056ZPzoZGGA= golang.org/x/exp v0.0.0-20211216164055-b2b84827b756 h1:/5Bs7sWi0i3rOVO5KnM55OwugpsD4bRW1zywKoZjbkI= -golang.org/x/exp v0.0.0-20211216164055-b2b84827b756/go.mod h1:b9TAUYHmRtqA6klRHApnXMnj+OyLce4yF5cZCUbk2ps= golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e h1:qyrTQ++p1afMkO4DPEeLGq/3oTsdlvdH4vqZUBWzUKM= golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= @@ -971,8 +947,6 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1-0.20210830214625-1b1db11ec8f4/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -996,7 +970,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1023,11 +996,10 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220401154927-543a649e0bdd h1:zYlwaUHTmxuf6H7hwO2dgwqozQmH7zf4x+/qql4oVWc= +golang.org/x/net v0.0.0-20220401154927-543a649e0bdd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1078,8 +1050,6 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191112214154-59a1497f0cea/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1125,12 +1095,10 @@ golang.org/x/sys v0.0.0-20210601080250-7ecdf8ef093b/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= @@ -1172,7 +1140,6 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1209,7 +1176,6 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201118003311-bd56c0adb394/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1217,8 +1183,6 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a h1:ofrrl6c6NG5/IOSx/R1cyiQxxjqlur0h/TvbUhkH0II= golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1369,7 +1333,6 @@ gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUy gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= @@ -1408,7 +1371,6 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -honnef.co/go/tools v0.2.0/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= honnef.co/go/tools v0.3.0 h1:2LdYUZ7CIxnYgskbUZfY7FPggmqnh6shBqfWa8Tn3XU= honnef.co/go/tools v0.3.0/go.mod h1:vlRD9XErLMGT+mDuofSr0mMMquscM/1nQqtRSsh6m70= rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= diff --git a/http/api_handler_test.go b/http/api_handler_test.go index 546a32eb0b..2f13145a9c 100644 --- a/http/api_handler_test.go +++ b/http/api_handler_test.go @@ -3,7 +3,7 @@ package http import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -121,7 +121,7 @@ func TestAPIHandler_NotFound(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. get %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/auth_test.go b/http/auth_test.go index ce725be2a6..316f85a10b 100644 --- a/http/auth_test.go +++ b/http/auth_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -357,7 +357,7 @@ func TestService_handleGetAuthorizations(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetAuthorizations() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -545,7 +545,7 @@ func TestService_handleGetAuthorization(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Logf("headers: %v body: %s", res.Header, body) @@ -726,7 +726,7 @@ func TestService_handlePostAuthorization(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Logf("headers: %v body: %s", res.Header, body) @@ -838,7 +838,7 @@ func TestService_handleDeleteAuthorization(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleDeleteAuthorization() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/check_service.go b/http/check_service.go index fbb8199026..8301c3eef5 100644 --- a/http/check_service.go +++ b/http/check_service.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "path" "time" @@ -401,7 +401,7 @@ type decodeStatus struct { } func decodePostCheckRequest(r *http.Request) (postCheckRequest, error) { - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) if err != nil { return postCheckRequest{}, &errors.Error{ Code: errors.EInvalid, @@ -461,7 +461,7 @@ func decodePutCheckRequest(ctx context.Context, lang fluxlang.FluxLanguageServic } } - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) if err != nil { return influxdb.CheckCreate{}, &errors.Error{ Code: errors.EInvalid, diff --git a/http/delete_test.go b/http/delete_test.go index c75d5a587f..8e29f64124 100644 --- a/http/delete_test.go +++ b/http/delete_test.go @@ -4,7 +4,7 @@ import ( "bytes" "context" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -403,7 +403,7 @@ func TestDelete(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleDelete() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/document_test.go b/http/document_test.go index d70ba35ed8..a669f50f8f 100644 --- a/http/document_test.go +++ b/http/document_test.go @@ -2,7 +2,7 @@ package http import ( "context" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -151,7 +151,7 @@ func TestService_handleGetDocuments(t *testing.T) { h.handleGetDocuments(w, r) res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetDocuments() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/health_test.go b/http/health_test.go index a93af0be2d..3e5f754f52 100644 --- a/http/health_test.go +++ b/http/health_test.go @@ -2,7 +2,7 @@ package http import ( "encoding/json" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -36,7 +36,7 @@ func TestHealthHandler(t *testing.T) { HealthHandler(tt.w, tt.r) res := tt.w.Result() contentType := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. HealthHandler() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/label_test.go b/http/label_test.go index 5fa5ba4cc9..57fff91198 100644 --- a/http/label_test.go +++ b/http/label_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -123,7 +123,7 @@ func TestService_handleGetLabels(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetLabels() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -241,7 +241,7 @@ func TestService_handleGetLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetLabel() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -330,7 +330,7 @@ func TestService_handlePostLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePostLabel() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -427,7 +427,7 @@ func TestService_handleDeleteLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePostLabel() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -576,7 +576,7 @@ func TestService_handlePatchLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePatchLabel() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/legacy/influxqld_handler.go b/http/legacy/influxqld_handler.go index e14f7d6f82..8f8da4b500 100644 --- a/http/legacy/influxqld_handler.go +++ b/http/legacy/influxqld_handler.go @@ -2,9 +2,10 @@ package legacy import ( "encoding/json" - "io/ioutil" + "io" "mime" "net/http" + "os" "strconv" "strings" @@ -69,7 +70,7 @@ func (h *InfluxqlHandler) handleInfluxqldQuery(w http.ResponseWriter, r *http.Re } else if r.MultipartForm != nil && r.MultipartForm.File != nil { // If we have a multipart/form-data, try to retrieve a file from 'q'. if fhs := r.MultipartForm.File["q"]; len(fhs) > 0 { - d, err := ioutil.ReadFile(fhs[0].Filename) + d, err := os.ReadFile(fhs[0].Filename) if err != nil { h.HandleHTTPError(ctx, err, w) return @@ -88,7 +89,7 @@ func (h *InfluxqlHandler) handleInfluxqldQuery(w http.ResponseWriter, r *http.Re } if mt == "application/vnd.influxql" { - if d, err := ioutil.ReadAll(r.Body); err != nil { + if d, err := io.ReadAll(r.Body); err != nil { h.HandleHTTPError(ctx, err, w) return } else { diff --git a/http/middleware_test.go b/http/middleware_test.go index 2e82048685..4c59377088 100644 --- a/http/middleware_test.go +++ b/http/middleware_test.go @@ -60,15 +60,11 @@ func TestLoggingMW(t *testing.T) { } getKVPair := func(s string) (string, string) { - kv := strings.Split(s, "=") - switch len(kv) { - case 1: - return kv[0], "" - case 2: - return kv[0], strings.TrimSuffix(kv[1], "\n") - default: - return "", "" + k, v, _ := strings.Cut(s, "=") + if v != "" { + v = strings.TrimSuffix(v, "\n") } + return k, v } echoHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/http/notification_endpoint.go b/http/notification_endpoint.go index b5473cbbde..f5187cfc98 100644 --- a/http/notification_endpoint.go +++ b/http/notification_endpoint.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "github.com/influxdata/httprouter" @@ -301,7 +301,7 @@ func decodeNotificationEndpointFilter(ctx context.Context, r *http.Request) (inf } func decodePostNotificationEndpointRequest(r *http.Request) (postNotificationEndpointRequest, error) { - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) if err != nil { return postNotificationEndpointRequest{}, &errors.Error{ Code: errors.EInvalid, diff --git a/http/notification_endpoint_test.go b/http/notification_endpoint_test.go index 5475c565d8..63bfe125cd 100644 --- a/http/notification_endpoint_test.go +++ b/http/notification_endpoint_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "path" @@ -246,7 +246,7 @@ func TestService_handleGetNotificationEndpoints(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetNotificationEndpoints() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -384,7 +384,7 @@ func TestService_handleGetNotificationEndpoint(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) t.Logf(res.Header.Get("X-Influx-Error")) if res.StatusCode != tt.wants.statusCode { @@ -734,7 +734,7 @@ func TestService_handlePatchNotificationEndpoint(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePatchNotificationEndpoint() = %v, want %v %v", tt.name, res.StatusCode, tt.wants.statusCode, w.Header()) @@ -954,7 +954,7 @@ func TestService_handlePostNotificationEndpointMember(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePostNotificationEndpointMember() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -1048,7 +1048,7 @@ func TestService_handlePostNotificationEndpointOwner(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePostNotificationEndpointOwner() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/query.go b/http/query.go index a7790e7465..8cafc0dfe9 100644 --- a/http/query.go +++ b/http/query.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "mime" "net/http" "time" @@ -294,7 +293,7 @@ func decodeQueryRequest(ctx context.Context, r *http.Request, svc influxdb.Organ } switch mt { case fluxContentType: - octets, err := ioutil.ReadAll(body) + octets, err := io.ReadAll(body) if err != nil { return nil, body.bytesRead, err } diff --git a/http/query_handler.go b/http/query_handler.go index 785606c632..0718721ed2 100644 --- a/http/query_handler.go +++ b/http/query_handler.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/url" "time" @@ -590,7 +589,7 @@ func GetQueryResponseBody(res *http.Response) ([]byte, error) { return nil, err } defer res.Body.Close() - return ioutil.ReadAll(res.Body) + return io.ReadAll(res.Body) } // SimpleQuery runs a flux query with common parameters and returns CSV results. diff --git a/http/query_handler_test.go b/http/query_handler_test.go index d5fa0a7c72..6997002a98 100644 --- a/http/query_handler_test.go +++ b/http/query_handler_test.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/http/httptest" "reflect" @@ -369,7 +368,7 @@ func TestFluxHandler_PostQuery_Errors(t *testing.T) { t.Errorf("expected unauthorized status, got %d", resp.StatusCode) } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatal(err) } @@ -557,7 +556,7 @@ func TestFluxService_Query_gzip(t *testing.T) { t.Errorf("unexpected status code %s", res.Status) } - identityBody, _ := ioutil.ReadAll(res.Body) + identityBody, _ := io.ReadAll(res.Body) _ = res.Body.Close() // now, we try to use gzip @@ -576,7 +575,7 @@ func TestFluxService_Query_gzip(t *testing.T) { t.Fatalf("unable to POST to server: %v", err) } - gzippedBody, _ := ioutil.ReadAll(res.Body) + gzippedBody, _ := io.ReadAll(res.Body) _ = res.Body.Close() if res.StatusCode != http.StatusOK { @@ -693,7 +692,7 @@ func benchmarkQuery(b *testing.B, disableCompression bool) { b.Errorf("unexpected status code %s", res.Status) } - _, _ = ioutil.ReadAll(res.Body) + _, _ = io.ReadAll(res.Body) _ = res.Body.Close() } diff --git a/http/ready_test.go b/http/ready_test.go index 948d27c5c2..a7825ea5a5 100644 --- a/http/ready_test.go +++ b/http/ready_test.go @@ -2,7 +2,7 @@ package http import ( "encoding/json" - "io/ioutil" + "io" "net/http" "net/http/httptest" "strings" @@ -15,7 +15,7 @@ func TestReadyHandler(t *testing.T) { ReadyHandler().ServeHTTP(w, r) res := w.Result() contentType := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != 200 { t.Errorf("TestReadyHandler. ReadyHandler() StatusCode = %v, want 200", res.StatusCode) diff --git a/http/resources_test.go b/http/resources_test.go index 45d367d3ff..e5426a8294 100644 --- a/http/resources_test.go +++ b/http/resources_test.go @@ -2,7 +2,7 @@ package http import ( "encoding/json" - "io/ioutil" + "io" "net/http" "net/http/httptest" "reflect" @@ -48,7 +48,7 @@ func TestResourceListHandler(t *testing.T) { } resp := w.Result() - body, _ := ioutil.ReadAll(resp.Body) + body, _ := io.ReadAll(resp.Body) if resp.StatusCode != http.StatusOK { t.Logf(string(body)) t.Errorf("unexpected status: %s", resp.Status) diff --git a/http/restore_service.go b/http/restore_service.go index 34562526a1..a08a74a0e0 100644 --- a/http/restore_service.go +++ b/http/restore_service.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "strconv" "time" @@ -198,7 +197,7 @@ func (h *RestoreHandler) handleRestoreBucket(w http.ResponseWriter, r *http.Requ } // Read serialized DBI data. - buf, err := ioutil.ReadAll(r.Body) + buf, err := io.ReadAll(r.Body) if err != nil { h.HandleHTTPError(ctx, err, w) return diff --git a/http/router_test.go b/http/router_test.go index 60156c6358..ccfcf34bd1 100644 --- a/http/router_test.go +++ b/http/router_test.go @@ -2,7 +2,7 @@ package http import ( "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -92,7 +92,7 @@ func TestRouter_NotFound(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. get %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -199,7 +199,7 @@ func TestRouter_Panic(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. get %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -298,7 +298,7 @@ func TestRouter_MethodNotAllowed(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. get %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/scraper_service_test.go b/http/scraper_service_test.go index a8c53dd215..693c0bedb9 100644 --- a/http/scraper_service_test.go +++ b/http/scraper_service_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -232,7 +232,7 @@ func TestService_handleGetScraperTargets(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetScraperTargets() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -371,7 +371,7 @@ func TestService_handleGetScraperTarget(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetScraperTarget() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -477,7 +477,7 @@ func TestService_handleDeleteScraperTarget(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleDeleteScraperTarget() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -605,7 +605,7 @@ func TestService_handlePostScraperTarget(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePostScraperTarget() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -797,7 +797,7 @@ func TestService_handlePatchScraperTarget(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePatchScraperTarget() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/task_service_test.go b/http/task_service_test.go index 1c592eb256..e896d60f5b 100644 --- a/http/task_service_test.go +++ b/http/task_service_test.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "strings" @@ -404,7 +404,7 @@ func TestTaskHandler_handleGetTasks(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetTasks() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -570,7 +570,7 @@ func TestTaskHandler_handlePostTasks(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePostTask() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -684,7 +684,7 @@ func TestTaskHandler_handleGetRun(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetRun() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -802,7 +802,7 @@ func TestTaskHandler_handleGetRuns(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetRuns() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -1083,7 +1083,7 @@ func TestTaskHandler_NotFoundStatus(t *testing.T) { if res.StatusCode < 200 || res.StatusCode > 299 { t.Errorf("expected OK, got %d", res.StatusCode) - b, _ := ioutil.ReadAll(res.Body) + b, _ := io.ReadAll(res.Body) t.Fatalf("body: %s", string(b)) } }) @@ -1104,7 +1104,7 @@ func TestTaskHandler_NotFoundStatus(t *testing.T) { if res.StatusCode != http.StatusNotFound { t.Errorf("expected Not Found, got %d", res.StatusCode) - b, _ := ioutil.ReadAll(res.Body) + b, _ := io.ReadAll(res.Body) t.Fatalf("body: %s", string(b)) } }) @@ -1197,7 +1197,7 @@ func TestService_handlePostTaskLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("got %v, want %v", res.StatusCode, tt.wants.statusCode) @@ -1295,7 +1295,7 @@ func TestTaskHandler_CreateTaskWithOrgName(t *testing.T) { res := w.Result() defer res.Body.Close() - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { t.Fatal(err) } @@ -1430,7 +1430,7 @@ func TestTaskHandler_Sessions(t *testing.T) { h.handleGetRuns(w, r) res := w.Result() - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { t.Fatal(err) } @@ -1469,7 +1469,7 @@ func TestTaskHandler_Sessions(t *testing.T) { h.handleGetRuns(w, r) res = w.Result() - body, err = ioutil.ReadAll(res.Body) + body, err = io.ReadAll(res.Body) if err != nil { t.Fatal(err) } @@ -1526,7 +1526,7 @@ func TestTaskHandler_Sessions(t *testing.T) { h.handleGetRun(w, r) res := w.Result() - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { t.Fatal(err) } @@ -1563,7 +1563,7 @@ func TestTaskHandler_Sessions(t *testing.T) { h.handleGetRuns(w, r) res = w.Result() - body, err = ioutil.ReadAll(res.Body) + body, err = io.ReadAll(res.Body) if err != nil { t.Fatal(err) } @@ -1621,7 +1621,7 @@ func TestTaskHandler_Sessions(t *testing.T) { h.handleGetLogs(w, r) res := w.Result() - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { t.Fatal(err) } @@ -1658,7 +1658,7 @@ func TestTaskHandler_Sessions(t *testing.T) { h.handleGetRuns(w, r) res = w.Result() - body, err = ioutil.ReadAll(res.Body) + body, err = io.ReadAll(res.Body) if err != nil { t.Fatal(err) } @@ -1715,7 +1715,7 @@ func TestTaskHandler_Sessions(t *testing.T) { h.handleRetryRun(w, r) res := w.Result() - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { t.Fatal(err) } @@ -1752,7 +1752,7 @@ func TestTaskHandler_Sessions(t *testing.T) { h.handleGetRuns(w, r) res = w.Result() - body, err = ioutil.ReadAll(res.Body) + body, err = io.ReadAll(res.Body) if err != nil { t.Fatal(err) } diff --git a/http/telegraf_test.go b/http/telegraf_test.go index 2d4c343ef5..c00874bbb5 100644 --- a/http/telegraf_test.go +++ b/http/telegraf_test.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "strings" @@ -175,7 +175,7 @@ func TestTelegrafHandler_handleGetTelegrafs(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetTelegrafs() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -819,7 +819,7 @@ func TestTelegrafHandler_handleGetTelegraf(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetTelegraf() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/user_resource_mapping_test.go b/http/user_resource_mapping_test.go index e5f3cabbf5..d66a1e55d6 100644 --- a/http/user_resource_mapping_test.go +++ b/http/user_resource_mapping_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -208,7 +208,7 @@ func TestUserResourceMappingService_GetMembersHandler(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. GetMembersHandler() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -369,7 +369,7 @@ func TestUserResourceMappingService_PostMembersHandler(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. PostMembersHandler() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/http/variable_test.go b/http/variable_test.go index 7c03e28a4e..78bf6b3dde 100644 --- a/http/variable_test.go +++ b/http/variable_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "strconv" @@ -322,7 +322,7 @@ func TestVariableService_handleGetVariables(t *testing.T) { res := w.Result() contentType := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetVariables() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -452,7 +452,7 @@ func TestVariableService_handleGetVariable(t *testing.T) { res := w.Result() contentType := res.Header.Get("Content-Type") - bodyBytes, _ := ioutil.ReadAll(res.Body) + bodyBytes, _ := io.ReadAll(res.Body) body := string(bodyBytes[:]) if res.StatusCode != tt.wants.statusCode { @@ -582,7 +582,7 @@ func TestVariableService_handlePostVariable(t *testing.T) { res := w.Result() contentType := res.Header.Get("Content-Type") - bodyBytes, _ := ioutil.ReadAll(res.Body) + bodyBytes, _ := io.ReadAll(res.Body) body := string(bodyBytes[:]) if res.StatusCode != tt.wants.statusCode { @@ -685,7 +685,7 @@ func TestVariableService_handlePutVariable(t *testing.T) { res := w.Result() contentType := res.Header.Get("Content-Type") - bodyBytes, _ := ioutil.ReadAll(res.Body) + bodyBytes, _ := io.ReadAll(res.Body) body := string(bodyBytes[:]) if res.StatusCode != tt.wants.statusCode { @@ -794,7 +794,7 @@ func TestVariableService_handlePatchVariable(t *testing.T) { res := w.Result() contentType := res.Header.Get("Content-Type") - bodyBytes, _ := ioutil.ReadAll(res.Body) + bodyBytes, _ := io.ReadAll(res.Body) body := string(bodyBytes[:]) if res.StatusCode != tt.wants.statusCode { @@ -979,7 +979,7 @@ func TestService_handlePostVariableLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("got %v, want %v", res.StatusCode, tt.wants.statusCode) diff --git a/http/write_handler_test.go b/http/write_handler_test.go index 9bc547f131..41445a4e5b 100644 --- a/http/write_handler_test.go +++ b/http/write_handler_test.go @@ -5,7 +5,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "net/http" "net/http/httptest" "strings" @@ -121,7 +120,7 @@ func TestWriteService_WriteTo(t *testing.T) { defer r.Body.Close() in, _ := gzip.NewReader(r.Body) defer in.Close() - lp, _ = ioutil.ReadAll(in) + lp, _ = io.ReadAll(in) w.WriteHeader(tt.status) })) s := &WriteService{ diff --git a/influxql/v1tests/server_helpers.go b/influxql/v1tests/server_helpers.go index 3b251f0279..123ba6efbb 100644 --- a/influxql/v1tests/server_helpers.go +++ b/influxql/v1tests/server_helpers.go @@ -3,7 +3,7 @@ package v1tests import ( "context" "encoding/json" - "io/ioutil" + "io" "net/http" "net/url" "strings" @@ -75,7 +75,7 @@ func (q *Query) Execute(ctx context.Context, t *testing.T, db string, c *tests.C Header("Accept", "application/json"). RespFn(func(resp *http.Response) error { require.Equal(t, "application/json", resp.Header.Get("Content-Type")) - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) q.got = strings.TrimSpace(string(b)) return err }). diff --git a/influxql/v1validation/validation_test.go b/influxql/v1validation/validation_test.go index 0abcd9868f..c34a19bc65 100644 --- a/influxql/v1validation/validation_test.go +++ b/influxql/v1validation/validation_test.go @@ -3,7 +3,7 @@ package v1validation import ( "context" "fmt" - "io/ioutil" + "io" "net/http" "os" "path/filepath" @@ -75,7 +75,7 @@ func testSuiteFromPath(t *testing.T, path string) *TestSuite { if err != nil { t.Fatal(err) } - b, err := ioutil.ReadAll(f) + b, err := io.ReadAll(f) if err != nil { t.Fatal(err) } @@ -178,7 +178,7 @@ func validate(t *testing.T, gf *TestSuite) { Header("Content-Type", "application/vnd.influxql"). Header("Accept", "application/csv"). RespFn(func(resp *http.Response) error { - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) assert.NoError(t, err) assert.Equal(t, test.Result, string(b)) return nil diff --git a/jsonweb/fuzz.go b/jsonweb/fuzz.go index 4362bcf98b..352cbeef03 100644 --- a/jsonweb/fuzz.go +++ b/jsonweb/fuzz.go @@ -1,8 +1,9 @@ //go:build gofuzz -// +build gofuzz package jsonweb +// TODO(DStrand1): Convert this to Go 1.18's new Fuzzing with testing.F + // FuzzJsonWeb is the entry point for fuzzing when built with go-fuzz-build. func FuzzJsonWeb(data []byte) int { var keyStore = KeyStoreFunc(func(kid string) ([]byte, error) { diff --git a/kit/cli/viper_test.go b/kit/cli/viper_test.go index 8cdc139126..e51c936a2f 100644 --- a/kit/cli/viper_test.go +++ b/kit/cli/viper_test.go @@ -3,7 +3,6 @@ package cli import ( "encoding/json" "fmt" - "io/ioutil" "math" "os" "path" @@ -185,7 +184,7 @@ func Test_NewProgram(t *testing.T) { for _, tt := range tests { for _, writer := range configWriters { fn := func(t *testing.T) { - testDir, err := ioutil.TempDir("", "") + testDir, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(testDir) @@ -275,7 +274,7 @@ func writeJsonConfig(dir string, config interface{}) (string, error) { return "", err } confFile := path.Join(dir, "config.json") - if err := ioutil.WriteFile(confFile, b, os.ModePerm); err != nil { + if err := os.WriteFile(confFile, b, os.ModePerm); err != nil { return "", err } return confFile, nil @@ -383,7 +382,7 @@ func Test_ConfigPrecedence(t *testing.T) { for _, tt := range tests { fn := func(t *testing.T) { - testDir, err := ioutil.TempDir("", "") + testDir, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(testDir) defer setEnvVar("TEST_CONFIG_PATH", testDir)() @@ -430,7 +429,7 @@ func Test_ConfigPrecedence(t *testing.T) { } func Test_ConfigPathDotDirectory(t *testing.T) { - testDir, err := ioutil.TempDir("", "") + testDir, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(testDir) @@ -488,7 +487,7 @@ func Test_ConfigPathDotDirectory(t *testing.T) { } func Test_LoadConfigCwd(t *testing.T) { - testDir, err := ioutil.TempDir("", "") + testDir, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(testDir) diff --git a/kit/feature/_codegen/main.go b/kit/feature/_codegen/main.go index 7033cea193..ee27f27dd9 100644 --- a/kit/feature/_codegen/main.go +++ b/kit/feature/_codegen/main.go @@ -5,7 +5,7 @@ import ( "flag" "fmt" "go/format" - "io/ioutil" + "io" "os" "strings" "text/template" @@ -152,7 +152,7 @@ func run() error { } defer in.Close() - configuration, err := ioutil.ReadAll(in) + configuration, err := io.ReadAll(in) if err != nil { return err } @@ -192,7 +192,7 @@ func run() error { return err } - raw, err := ioutil.ReadAll(buf) + raw, err := io.ReadAll(buf) if err != nil { return err } diff --git a/kit/feature/http_proxy_test.go b/kit/feature/http_proxy_test.go index a0fd57cf33..0853375d96 100644 --- a/kit/feature/http_proxy_test.go +++ b/kit/feature/http_proxy_test.go @@ -3,7 +3,7 @@ package feature import ( "context" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "net/url" @@ -32,7 +32,7 @@ func TestHTTPProxy_Proxying(t *testing.T) { t.Error("X-Platform-Proxy-Flag header not populated") } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Error(err) } @@ -56,7 +56,7 @@ func TestHTTPProxy_DefaultBehavior(t *testing.T) { t.Error("X-Platform-Proxy-Flag header populated") } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Error(err) } diff --git a/kit/io/limited_read_closer_test.go b/kit/io/limited_read_closer_test.go index 357da74646..09965f9921 100644 --- a/kit/io/limited_read_closer_test.go +++ b/kit/io/limited_read_closer_test.go @@ -4,7 +4,6 @@ import ( "bytes" "errors" "io" - "io/ioutil" "testing" "github.com/stretchr/testify/assert" @@ -15,7 +14,7 @@ func TestLimitedReadCloser_Exceeded(t *testing.T) { b := &closer{Reader: bytes.NewBufferString("howdy")} rc := NewLimitedReadCloser(b, 3) - out, err := ioutil.ReadAll(rc) + out, err := io.ReadAll(rc) require.NoError(t, err) assert.Equal(t, []byte("how"), out) assert.Equal(t, ErrReadLimitExceeded, rc.Close()) @@ -25,7 +24,7 @@ func TestLimitedReadCloser_Happy(t *testing.T) { b := &closer{Reader: bytes.NewBufferString("ho")} rc := NewLimitedReadCloser(b, 2) - out, err := ioutil.ReadAll(rc) + out, err := io.ReadAll(rc) require.NoError(t, err) assert.Equal(t, []byte("ho"), out) assert.Nil(t, err) @@ -38,7 +37,7 @@ func TestLimitedReadCloseWithErrorAndLimitExceeded(t *testing.T) { } rc := NewLimitedReadCloser(b, 3) - out, err := ioutil.ReadAll(rc) + out, err := io.ReadAll(rc) require.NoError(t, err) assert.Equal(t, []byte("how"), out) // LimitExceeded error trumps the close error. @@ -53,7 +52,7 @@ func TestLimitedReadCloseWithError(t *testing.T) { } rc := NewLimitedReadCloser(b, 10) - out, err := ioutil.ReadAll(rc) + out, err := io.ReadAll(rc) require.NoError(t, err) assert.Equal(t, []byte("howdy"), out) assert.Equal(t, closeErr, rc.Close()) @@ -67,7 +66,7 @@ func TestMultipleCloseOnlyClosesOnce(t *testing.T) { } rc := NewLimitedReadCloser(b, 10) - out, err := ioutil.ReadAll(rc) + out, err := io.ReadAll(rc) require.NoError(t, err) assert.Equal(t, []byte("howdy"), out) assert.Equal(t, closeErr, rc.Close()) diff --git a/kit/signals/context_test.go b/kit/signals/context_test.go index 2baf65dcc2..24714aff9d 100644 --- a/kit/signals/context_test.go +++ b/kit/signals/context_test.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package signals diff --git a/kv/index.go b/kv/index.go index 3470cf7286..fb5dbc85b4 100644 --- a/kv/index.go +++ b/kv/index.go @@ -155,14 +155,10 @@ func IndexKey(foreignKey, primaryKey []byte) (newKey []byte, err error) { func indexKeyParts(indexKey []byte) (fk, pk []byte, err error) { // this function is called with items missing in index - parts := bytes.SplitN(indexKey, []byte("/"), 2) - if len(parts) < 2 { + fk, pk, ok := bytes.Cut(indexKey, []byte("/")) + if !ok { return nil, nil, errors.New("malformed index key") } - - // parts are fk/pk - fk, pk = parts[0], parts[1] - return } diff --git a/kv/index_test.go b/kv/index_test.go index 8b92ee46f9..663297e301 100644 --- a/kv/index_test.go +++ b/kv/index_test.go @@ -3,7 +3,6 @@ package kv_test import ( "context" "errors" - "io/ioutil" "os" "testing" @@ -177,7 +176,7 @@ func Benchmark_Inmem_Index_Walk(b *testing.B) { } func Benchmark_Bolt_Index_Walk(b *testing.B) { - f, err := ioutil.TempFile("", "influxdata-bolt-") + f, err := os.CreateTemp("", "influxdata-bolt-") if err != nil { b.Fatal(errors.New("unable to open temporary boltdb file")) } diff --git a/kv/migration/create.go b/kv/migration/create.go index 8bdbdb07a5..70e22de122 100644 --- a/kv/migration/create.go +++ b/kv/migration/create.go @@ -5,7 +5,7 @@ import ( "fmt" "go/format" "html/template" - "io/ioutil" + "os" "strings" "golang.org/x/text/cases" @@ -30,13 +30,13 @@ func CreateNewMigration(existing []Spec, name string) error { fmt.Println("Creating new migration:", newMigrationFile) - if err := ioutil.WriteFile(newMigrationFile, []byte(fmt.Sprintf(newMigrationFmt, newMigrationVariable)), 0644); err != nil { + if err := os.WriteFile(newMigrationFile, []byte(fmt.Sprintf(newMigrationFmt, newMigrationVariable)), 0644); err != nil { return err } fmt.Println("Inserting migration into ./kv/migration/all/all.go") - tmplData, err := ioutil.ReadFile("./kv/migration/all/all.go") + tmplData, err := os.ReadFile("./kv/migration/all/all.go") if err != nil { return err } @@ -69,7 +69,7 @@ func CreateNewMigration(existing []Spec, name string) error { return err } - if err := ioutil.WriteFile("./kv/migration/all/all.go", src, 0644); err != nil { + if err := os.WriteFile("./kv/migration/all/all.go", src, 0644); err != nil { return err } diff --git a/kv/migration/migration_test.go b/kv/migration/migration_test.go index 6e282013c4..fa25519bc5 100644 --- a/kv/migration/migration_test.go +++ b/kv/migration/migration_test.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "io/ioutil" "os" "testing" "time" @@ -103,7 +102,7 @@ func Test_Bolt_MigratorWithBackup(t *testing.T) { } func newTestBoltStoreWithoutMigrations(t *testing.T) (*bolt.KVStore, func(), error) { - f, err := ioutil.TempFile("", "influxdata-bolt-") + f, err := os.CreateTemp("", "influxdata-bolt-") if err != nil { return nil, nil, errors.New("unable to open temporary boltdb file") } diff --git a/label/http_server_test.go b/label/http_server_test.go index 45769ca961..a1c39a9c6b 100644 --- a/label/http_server_test.go +++ b/label/http_server_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -94,7 +94,7 @@ func TestService_handlePostLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePostLabel() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -207,7 +207,7 @@ func TestService_handleGetLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetLabel() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -330,7 +330,7 @@ func TestService_handleGetLabels(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetLabels() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -470,7 +470,7 @@ func TestService_handlePatchLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handlePatchLabel() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -566,7 +566,7 @@ func TestService_handleDeleteLabel(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleDeleteLabel() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/notification/endpoint/http.go b/notification/endpoint/http.go index 062c9e5314..75cf1e66d0 100644 --- a/notification/endpoint/http.go +++ b/notification/endpoint/http.go @@ -3,7 +3,7 @@ package endpoint import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/url" @@ -141,7 +141,7 @@ func (s HTTP) Type() string { // ParseResponse will parse the http response from http. func (s HTTP) ParseResponse(resp *http.Response) error { if resp.StatusCode != http.StatusOK { - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return err } diff --git a/pkg/cmputil/cmputil.go b/pkg/cmputil/cmputil.go index efdefc62b2..5d04dc95df 100644 --- a/pkg/cmputil/cmputil.go +++ b/pkg/cmputil/cmputil.go @@ -34,5 +34,5 @@ func isExported(id string) bool { var messageType = reflect.TypeOf((*proto.Message)(nil)).Elem() func implementsProtoMessage(t reflect.Type) bool { - return t.Implements(messageType) || reflect.PtrTo(t).Implements(messageType) + return t.Implements(messageType) || reflect.PointerTo(t).Implements(messageType) } diff --git a/pkg/deep/equal.go b/pkg/deep/equal.go index 63944172f2..1291554db7 100644 --- a/pkg/deep/equal.go +++ b/pkg/deep/equal.go @@ -123,7 +123,7 @@ func deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool, depth int) boo return v1.IsNil() == v2.IsNil() } return deepValueEqual(v1.Elem(), v2.Elem(), visited, depth+1) - case reflect.Ptr: + case reflect.Pointer: return deepValueEqual(v1.Elem(), v2.Elem(), visited, depth+1) case reflect.Struct: for i, n := 0, v1.NumField(); i < n; i++ { diff --git a/pkg/durablequeue/queue.go b/pkg/durablequeue/queue.go index f13faacd3c..5d75f80b36 100644 --- a/pkg/durablequeue/queue.go +++ b/pkg/durablequeue/queue.go @@ -5,7 +5,6 @@ import ( "encoding/binary" "fmt" "io" - "io/ioutil" "os" "path/filepath" "sort" @@ -233,7 +232,7 @@ func (l *Queue) RemoveSegments() error { return fmt.Errorf("queue is open") } - files, err := ioutil.ReadDir(l.dir) + files, err := os.ReadDir(l.dir) if err != nil { return err } @@ -395,7 +394,7 @@ func (l *Queue) addSegment() error { func (l *Queue) loadSegments() (segments, error) { var ss segments - files, err := ioutil.ReadDir(l.dir) + files, err := os.ReadDir(l.dir) if err != nil { return ss, err } @@ -440,7 +439,7 @@ func (l *Queue) loadSegments() (segments, error) { // nextSegmentID returns the next segment ID that is free. func (l *Queue) nextSegmentID() (uint64, error) { - segments, err := ioutil.ReadDir(l.dir) + segments, err := os.ReadDir(l.dir) if err != nil { return 0, err } diff --git a/pkg/durablequeue/queue_test.go b/pkg/durablequeue/queue_test.go index 88d1b2516c..eca842c613 100644 --- a/pkg/durablequeue/queue_test.go +++ b/pkg/durablequeue/queue_test.go @@ -4,7 +4,6 @@ import ( "encoding/binary" "fmt" "io" - "io/ioutil" "math" "os" "path/filepath" @@ -573,7 +572,7 @@ func (s *TestSegment) String() string { // mustCreateSegment calls newSegment, which means it calls open on the segment, // and possibly attempts to repair the TestSegment. func mustCreateSegment(ts *TestSegment, dir string, vf func([]byte) error) *segment { - fd, err := ioutil.TempFile(dir, "") + fd, err := os.CreateTemp(dir, "") if err != nil { panic(err) } @@ -598,7 +597,7 @@ func mustCreateSegment(ts *TestSegment, dir string, vf func([]byte) error) *segm // ReadSegment returns a hexadecimal representation of a segment. func ReadSegment(segment *segment) string { - data, err := ioutil.ReadFile(segment.path) + data, err := os.ReadFile(segment.path) if err != nil { panic(err) } @@ -606,7 +605,7 @@ func ReadSegment(segment *segment) string { } func TestSegment_repair(t *testing.T) { - dir, err := ioutil.TempDir("", "hh_queue") + dir, err := os.MkdirTemp("", "hh_queue") if err != nil { t.Fatalf("failed to create temp dir: %v", err) } diff --git a/pkg/durablequeue/scanner_test.go b/pkg/durablequeue/scanner_test.go index 549f994356..6a14c56cb3 100644 --- a/pkg/durablequeue/scanner_test.go +++ b/pkg/durablequeue/scanner_test.go @@ -4,7 +4,6 @@ import ( "encoding/binary" "fmt" "io" - "io/ioutil" "os" "reflect" "testing" @@ -52,7 +51,7 @@ func newTestQueue(t testing.TB, fns ...func(o *opts)) (*Queue, string) { tmp = os.ExpandEnv(htmp) } - dir, err := ioutil.TempDir(tmp, "hh_queue") + dir, err := os.MkdirTemp(tmp, "hh_queue") require.NoError(t, err) q, err := NewQueue(dir, opts.maxSize, opts.maxSegmentSize, &SharedCount{}, MaxWritesPending, opts.fn) @@ -254,7 +253,7 @@ func TestQueue_NewScanner_Corrupted(t *testing.T) { var buf [8]byte binary.BigEndian.PutUint64(buf[:], uint64(1<<63)) - err := ioutil.WriteFile(q.segments[0].path, buf[:], os.ModePerm) + err := os.WriteFile(q.segments[0].path, buf[:], os.ModePerm) if err != nil { t.Fatalf("WriteFile: %v", err) } diff --git a/pkg/file/file_unix.go b/pkg/file/file_unix.go index 74ffeb243c..66609888e5 100644 --- a/pkg/file/file_unix.go +++ b/pkg/file/file_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package file diff --git a/pkg/fs/fs_test.go b/pkg/fs/fs_test.go index 05d68b149a..3e7b35dddb 100644 --- a/pkg/fs/fs_test.go +++ b/pkg/fs/fs_test.go @@ -1,7 +1,7 @@ package fs_test import ( - "io/ioutil" + "io" "os" "path/filepath" "testing" @@ -94,7 +94,7 @@ func testFileMoveOrRename(t *testing.T, name string, testFunc func(src string, d func MustCreateTempFile(t testing.TB, data string) string { t.Helper() - f, err := ioutil.TempFile("", "fs-test") + f, err := os.CreateTemp("", "fs-test") if err != nil { t.Fatalf("failed to create temp file: %v", err) } else if _, err := f.WriteString(data); err != nil { @@ -131,7 +131,7 @@ func MustReadAllFile(path string) string { } defer fd.Close() - data, err := ioutil.ReadAll(fd) + data, err := io.ReadAll(fd) if err != nil { panic(err) } diff --git a/pkg/fs/fs_unix.go b/pkg/fs/fs_unix.go index 8d19214c6f..646763824b 100644 --- a/pkg/fs/fs_unix.go +++ b/pkg/fs/fs_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package fs diff --git a/pkg/httpc/client_test.go b/pkg/httpc/client_test.go index b97d45e711..3463bcafc5 100644 --- a/pkg/httpc/client_test.go +++ b/pkg/httpc/client_test.go @@ -8,7 +8,6 @@ import ( "encoding/json" "errors" "io" - "io/ioutil" "net/http" "sort" "testing" @@ -381,7 +380,7 @@ func (f *fakeDoer) Do(r *http.Request) (*http.Response, error) { func stubResp(status int, _ *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: status, - Body: ioutil.NopCloser(new(bytes.Buffer)), + Body: io.NopCloser(new(bytes.Buffer)), }, nil } @@ -403,7 +402,7 @@ func stubRespNGZippedJSON(status int, r *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: status, - Body: ioutil.NopCloser(&buf), + Body: io.NopCloser(&buf), Header: http.Header{ "Content-Encoding": []string{"gzip"}, headerContentType: []string{"application/json"}, @@ -424,7 +423,7 @@ func stubRespNJSONBody(status int, r *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: status, - Body: ioutil.NopCloser(&buf), + Body: io.NopCloser(&buf), Header: http.Header{headerContentType: []string{"application/json"}}, }, nil } @@ -441,7 +440,7 @@ func stubRespNGobBody(status int, r *http.Request) (*http.Response, error) { } return &http.Response{ StatusCode: status, - Body: ioutil.NopCloser(&buf), + Body: io.NopCloser(&buf), Header: http.Header{headerContentEncoding: []string{"application/gob"}}, }, nil } diff --git a/pkg/httpc/req.go b/pkg/httpc/req.go index ac4cd66529..04857cc578 100644 --- a/pkg/httpc/req.go +++ b/pkg/httpc/req.go @@ -7,7 +7,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "strings" @@ -167,7 +166,7 @@ func (r *Req) do(ctx context.Context) error { return err } defer func() { - io.Copy(ioutil.Discard, resp.Body) // drain body completely + io.Copy(io.Discard, resp.Body) // drain body completely resp.Body.Close() }() diff --git a/pkg/jsonnet/decode.go b/pkg/jsonnet/decode.go index 6fcf69f7fa..79bfcf3f9d 100644 --- a/pkg/jsonnet/decode.go +++ b/pkg/jsonnet/decode.go @@ -3,7 +3,6 @@ package jsonnet import ( "encoding/json" "io" - "io/ioutil" "github.com/google/go-jsonnet" ) @@ -20,7 +19,7 @@ func NewDecoder(r io.Reader) *Decoder { // Decode decodes the stream into the provide value. func (d *Decoder) Decode(v interface{}) error { - b, err := ioutil.ReadAll(d.r) + b, err := io.ReadAll(d.r) if err != nil { return err } diff --git a/pkg/limiter/write_test.go b/pkg/limiter/write_test.go index 64c78a567f..b97e0f2bbf 100644 --- a/pkg/limiter/write_test.go +++ b/pkg/limiter/write_test.go @@ -3,7 +3,6 @@ package limiter_test import ( "bytes" "io" - "io/ioutil" "testing" "time" @@ -14,7 +13,7 @@ func TestWriter_Limited(t *testing.T) { r := bytes.NewReader(bytes.Repeat([]byte{0}, 1024*1024)) limit := 512 * 1024 - w := limiter.NewWriter(nopWriteCloser{ioutil.Discard}, limit, 10*1024*1024) + w := limiter.NewWriter(nopWriteCloser{io.Discard}, limit, 10*1024*1024) start := time.Now() n, err := io.Copy(w, r) diff --git a/pkg/mincore/mincore_unix.go b/pkg/mincore/mincore_unix.go index f1f6a09ea9..b44b7b2060 100644 --- a/pkg/mincore/mincore_unix.go +++ b/pkg/mincore/mincore_unix.go @@ -1,5 +1,4 @@ //go:build darwin || dragonfly || freebsd || linux || nacl || netbsd || openbsd -// +build darwin dragonfly freebsd linux nacl netbsd openbsd package mincore diff --git a/pkg/mincore/mincore_windows.go b/pkg/mincore/mincore_windows.go index ef9b4adcea..55e01a73d1 100644 --- a/pkg/mincore/mincore_windows.go +++ b/pkg/mincore/mincore_windows.go @@ -1,5 +1,4 @@ //go:build windows -// +build windows package mincore diff --git a/pkg/mmap/mmap_solaris.go b/pkg/mmap/mmap_solaris.go index f89e62da46..f313bdae52 100644 --- a/pkg/mmap/mmap_solaris.go +++ b/pkg/mmap/mmap_solaris.go @@ -1,5 +1,4 @@ //go:build solaris -// +build solaris package mmap diff --git a/pkg/mmap/mmap_test.go b/pkg/mmap/mmap_test.go index 12d15a3e31..5ebe1aa667 100644 --- a/pkg/mmap/mmap_test.go +++ b/pkg/mmap/mmap_test.go @@ -2,7 +2,7 @@ package mmap_test import ( "bytes" - "io/ioutil" + "os" "testing" "github.com/influxdata/influxdb/v2/pkg/mmap" @@ -14,8 +14,8 @@ func TestMap(t *testing.T) { t.Fatalf("Open: %v", err) } - if exp, err := ioutil.ReadFile("mmap_test.go"); err != nil { - t.Fatalf("ioutil.ReadFile: %v", err) + if exp, err := os.ReadFile("mmap_test.go"); err != nil { + t.Fatalf("os.ReadFile: %v", err) } else if !bytes.Equal(data, exp) { t.Fatalf("got %q\nwant %q", string(data), string(exp)) } diff --git a/pkg/mmap/mmap_unix.go b/pkg/mmap/mmap_unix.go index b451b248ea..e4e4cffb50 100644 --- a/pkg/mmap/mmap_unix.go +++ b/pkg/mmap/mmap_unix.go @@ -1,5 +1,4 @@ //go:build darwin || dragonfly || freebsd || linux || nacl || netbsd || openbsd -// +build darwin dragonfly freebsd linux nacl netbsd openbsd // Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/pkger/http_server_stack_test.go b/pkger/http_server_stack_test.go index 12cc054c02..cadd083654 100644 --- a/pkger/http_server_stack_test.go +++ b/pkger/http_server_stack_test.go @@ -5,9 +5,9 @@ import ( "context" "errors" "fmt" - "io/ioutil" "net/http" "net/http/httptest" + "os" "strings" "testing" "time" @@ -24,7 +24,7 @@ import ( func TestPkgerHTTPServerStacks(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadFile(strings.TrimPrefix(r.URL.Path, "/")) + b, err := os.ReadFile(strings.TrimPrefix(r.URL.Path, "/")) if err != nil { http.Error(w, err.Error(), 500) return diff --git a/pkger/http_server_template_test.go b/pkger/http_server_template_test.go index 1f8b569a70..a65a43923a 100644 --- a/pkger/http_server_template_test.go +++ b/pkger/http_server_template_test.go @@ -6,10 +6,10 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/http/httptest" "net/url" + "os" "path" "strings" "testing" @@ -34,7 +34,7 @@ import ( func TestPkgerHTTPServerTemplate(t *testing.T) { mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - b, err := ioutil.ReadFile(strings.TrimPrefix(r.URL.Path, "/")) + b, err := os.ReadFile(strings.TrimPrefix(r.URL.Path, "/")) if err != nil { http.Error(w, err.Error(), 500) return diff --git a/pkger/main_test.go b/pkger/main_test.go index d2e0ef88f1..67711f41c9 100644 --- a/pkger/main_test.go +++ b/pkger/main_test.go @@ -2,7 +2,6 @@ package pkger import ( "fmt" - "io/ioutil" "os" "path" "testing" @@ -16,10 +15,10 @@ var ( func TestMain(m *testing.M) { // this is to prime the files so we don't have to keep reading from disk for each test // cuts runtime of tests down by 80% on current mac - files, _ := ioutil.ReadDir("testdata") + files, _ := os.ReadDir("testdata") for _, f := range files { relativeName := path.Join("testdata", f.Name()) - b, err := ioutil.ReadFile(relativeName) + b, err := os.ReadFile(relativeName) if err == nil { availableTemplateFiles[relativeName] = b } diff --git a/pkger/parser.go b/pkger/parser.go index e60f6996b1..dce50ab942 100644 --- a/pkger/parser.go +++ b/pkger/parser.go @@ -6,10 +6,10 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net" "net/http" "net/url" + "os" "path" "regexp" "sort" @@ -118,7 +118,7 @@ func FromFile(filePath string) ReaderFn { } // not using os.Open to avoid having to deal with closing the file in here - b, err := ioutil.ReadFile(u.Path) + b, err := os.ReadFile(u.Path) if err != nil { return nil, filePath, err } @@ -253,7 +253,7 @@ func parseSource(r io.Reader, opts ...ValidateOptFn) (*Template, error) { if byter, ok := r.(interface{ Bytes() []byte }); ok { b = byter.Bytes() } else { - bb, err := ioutil.ReadAll(r) + bb, err := io.ReadAll(r) if err != nil { return nil, fmt.Errorf("failed to decode pkg source: %s", err) } diff --git a/query/logging_test.go b/query/logging_test.go index 9006965371..b905ff892b 100644 --- a/query/logging_test.go +++ b/query/logging_test.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "io" - "io/ioutil" "testing" "time" @@ -130,7 +129,7 @@ func TestLoggingProxyQueryService(t *testing.T) { }) lpqs := query.NewLoggingProxyQueryService(zap.NewNop(), logger, pqs, condLog) - _, err := lpqs.Query(context.Background(), ioutil.Discard, req) + _, err := lpqs.Query(context.Background(), io.Discard, req) if err != nil { t.Fatal(err) } @@ -140,7 +139,7 @@ func TestLoggingProxyQueryService(t *testing.T) { } ctx := context.WithValue(context.Background(), loggingCtxKey, true) - _, err = lpqs.Query(ctx, ioutil.Discard, req) + _, err = lpqs.Query(ctx, io.Discard, req) if err != nil { t.Fatal(err) } @@ -158,7 +157,7 @@ func TestLoggingProxyQueryService(t *testing.T) { reqMeta1 := query.RequireMetadataKey("this-metadata-wont-be-found") lpqs1 := query.NewLoggingProxyQueryService(zap.NewNop(), logger, pqs, reqMeta1) - _, err := lpqs1.Query(context.Background(), ioutil.Discard, req) + _, err := lpqs1.Query(context.Background(), io.Discard, req) if err != nil { t.Fatal(err) } @@ -170,7 +169,7 @@ func TestLoggingProxyQueryService(t *testing.T) { reqMeta2 := query.RequireMetadataKey("some-mock-metadata") lpqs2 := query.NewLoggingProxyQueryService(zap.NewNop(), logger, pqs, reqMeta2) - _, err = lpqs2.Query(context.Background(), ioutil.Discard, req) + _, err = lpqs2.Query(context.Background(), io.Discard, req) if err != nil { t.Fatal(err) } diff --git a/replications/remotewrite/writer_test.go b/replications/remotewrite/writer_test.go index ba6a64e5a5..3e00312af9 100644 --- a/replications/remotewrite/writer_test.go +++ b/replications/remotewrite/writer_test.go @@ -4,7 +4,7 @@ import ( "context" "errors" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "strconv" @@ -45,7 +45,7 @@ func constantStatus(i int) func(int) int { func testServer(t *testing.T, statusForCount func(int) int, wantData []byte) *httptest.Server { count := 0 return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - gotData, err := ioutil.ReadAll(r.Body) + gotData, err := io.ReadAll(r.Body) require.NoError(t, err) require.Equal(t, wantData, gotData) w.WriteHeader(statusForCount(count)) @@ -206,7 +206,7 @@ func TestWrite(t *testing.T) { waitTimeFromHeader := 5 * time.Second svr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - gotData, err := ioutil.ReadAll(r.Body) + gotData, err := io.ReadAll(r.Body) require.NoError(t, err) require.Equal(t, testData, gotData) w.Header().Set(retryAfterHeaderKey, strconv.Itoa(numSeconds)) @@ -363,7 +363,7 @@ func TestPostWrite(t *testing.T) { for _, tt := range tests { t.Run(fmt.Sprintf("status code %d", tt.status), func(t *testing.T) { svr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - recData, err := ioutil.ReadAll(r.Body) + recData, err := io.ReadAll(r.Body) require.NoError(t, err) require.Equal(t, testData, recData) diff --git a/scripts/ci/build-tests.sh b/scripts/ci/build-tests.sh index 488ab2176b..973126fcbd 100755 --- a/scripts/ci/build-tests.sh +++ b/scripts/ci/build-tests.sh @@ -24,7 +24,7 @@ function build_linux () { } function build_mac () { - CGO_ENABLED=1 PKG_CONFIG=$(which pkg-config) CC=x86_64-apple-darwin16-clang go-test-compile \ + CGO_ENABLED=1 PKG_CONFIG=$(which pkg-config) CC=x86_64-apple-darwin18-clang go-test-compile \ -tags sqlite_foreign_keys,sqlite_json -o "${1}/" ./... } diff --git a/scripts/ci/xcc.sh b/scripts/ci/xcc.sh index 4aa2e654d8..bce2a3da63 100755 --- a/scripts/ci/xcc.sh +++ b/scripts/ci/xcc.sh @@ -11,7 +11,7 @@ GOARCH=${GOARCH:-$(go env GOARCH)} case "${GOOS}_${GOARCH}" in linux_amd64) CC=musl-gcc ;; linux_arm64) CC=aarch64-unknown-linux-musl-gcc ;; - darwin_amd64) CC=x86_64-apple-darwin16-clang ;; + darwin_amd64) CC=x86_64-apple-darwin18-clang ;; windows_amd64) CC=x86_64-w64-mingw32-gcc ;; *) die "No cross-compiler set for ${GOOS}_${GOARCH}" ;; esac diff --git a/secret/http_server_test.go b/secret/http_server_test.go index fbf9a22c13..90fc9bd337 100644 --- a/secret/http_server_test.go +++ b/secret/http_server_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -163,7 +163,7 @@ func TestSecretService_handleGetSecrets(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("handleGetSecrets() = %v, want %v", res.StatusCode, tt.wants.statusCode) @@ -241,7 +241,7 @@ func TestSecretService_handlePatchSecrets(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("handlePatchSecrets() = %v, want %v", res.StatusCode, tt.wants.statusCode) @@ -324,7 +324,7 @@ func TestSecretService_handleDeleteSecrets(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("handleDeleteSecrets() = %v, want %v", res.StatusCode, tt.wants.statusCode) @@ -395,7 +395,7 @@ func TestSecretService_handleDeleteSecret(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("handleDeleteSecrets() = %v, want %v", res.StatusCode, tt.wants.statusCode) diff --git a/sqlite/sqlite.go b/sqlite/sqlite.go index e7963485b4..bf97527364 100644 --- a/sqlite/sqlite.go +++ b/sqlite/sqlite.go @@ -5,7 +5,6 @@ import ( "database/sql" "fmt" "io" - "io/ioutil" "os" "path/filepath" "sync" @@ -126,7 +125,7 @@ func (s *SqlStore) BackupSqlStore(ctx context.Context, w io.Writer) error { defer span.Finish() // create a destination db in a temporary directory to hold the backup. - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { return err } @@ -213,7 +212,7 @@ func sqliteFromSqlConn(c *sql.Conn) (*sqlite3.SQLiteConn, error) { // RestoreSqlStore replaces the underlying database with the data from r. func (s *SqlStore) RestoreSqlStore(ctx context.Context, r io.Reader) error { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") if err != nil { return err } diff --git a/sqlite/sqlite_helpers.go b/sqlite/sqlite_helpers.go index 3008ce1b7b..6facb8af86 100644 --- a/sqlite/sqlite_helpers.go +++ b/sqlite/sqlite_helpers.go @@ -1,7 +1,6 @@ package sqlite import ( - "io/ioutil" "os" "testing" @@ -10,7 +9,7 @@ import ( ) func NewTestStore(t *testing.T) (*SqlStore, func(t *testing.T)) { - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") require.NoError(t, err, "unable to create temporary test directory") s, err := NewSqlStore(tempDir+"/"+DefaultFilename, zap.NewNop()) diff --git a/sqlite/sqlite_test.go b/sqlite/sqlite_test.go index e97411ce5e..ae26e24b2e 100644 --- a/sqlite/sqlite_test.go +++ b/sqlite/sqlite_test.go @@ -3,7 +3,6 @@ package sqlite import ( "context" "fmt" - "io/ioutil" "os" "testing" @@ -60,7 +59,7 @@ func TestBackupSqlStore(t *testing.T) { // this temporary dir/file is is used as the source db path for testing a bacup // from a non-memory database. each individual test also creates a separate temporary dir/file // to backup into. - td, err := ioutil.TempDir("", "") + td, err := os.MkdirTemp("", "") require.NoError(t, err) tf := fmt.Sprintf("%s/%s", td, DefaultFilename) defer os.RemoveAll(td) @@ -95,7 +94,7 @@ func TestBackupSqlStore(t *testing.T) { require.NoError(t, err) // create a file to write the backup to. - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(tempDir) @@ -131,7 +130,7 @@ func TestRestoreSqlStore(t *testing.T) { // this temporary dir/file is is used as the destination db path for testing a restore // into a non-memory database. each individual test also creates a separate temporary dir/file // to hold a test db to restore from. - td, err := ioutil.TempDir("", "") + td, err := os.MkdirTemp("", "") require.NoError(t, err) tf := fmt.Sprintf("%s/%s", td, DefaultFilename) defer os.RemoveAll(td) @@ -154,7 +153,7 @@ func TestRestoreSqlStore(t *testing.T) { ctx := context.Background() // create the test db to restore from - tempDir, err := ioutil.TempDir("", "") + tempDir, err := os.MkdirTemp("", "") require.NoError(t, err) tempFileName := fmt.Sprintf("%s/%s", tempDir, DefaultFilename) defer os.RemoveAll(tempDir) diff --git a/static/TODO.go b/static/TODO.go index 671e4afd0b..62c2a5353d 100644 --- a/static/TODO.go +++ b/static/TODO.go @@ -1,5 +1,4 @@ //go:build !assets -// +build !assets package static diff --git a/static/static_test.go b/static/static_test.go index 6f236753de..139da2d9ba 100644 --- a/static/static_test.go +++ b/static/static_test.go @@ -3,7 +3,6 @@ package static import ( "io" "io/fs" - "io/ioutil" "net/http" "net/http/httptest" "testing" @@ -177,7 +176,7 @@ func TestOpenAsset(t *testing.T) { require.NoError(t, err) require.Equal(t, tt.fallback, fallback) - got, err := ioutil.ReadAll(gotFile) + got, err := io.ReadAll(gotFile) require.NoError(t, err) require.Equal(t, tt.want, got) diff --git a/storage/flux/table_test.go b/storage/flux/table_test.go index 09a9fee0a0..2d6f0879ef 100644 --- a/storage/flux/table_test.go +++ b/storage/flux/table_test.go @@ -3,7 +3,6 @@ package storageflux_test import ( "context" "io" - "io/ioutil" "math" "math/rand" "os" @@ -51,7 +50,7 @@ type StorageReader struct { } func NewStorageReader(tb testing.TB, setupFn SetupFunc) *StorageReader { - rootDir, err := ioutil.TempDir("", "storage-flux-test") + rootDir, err := os.MkdirTemp("", "storage-flux-test") if err != nil { tb.Fatal(err) } diff --git a/tag.go b/tag.go index 371c0482c6..22fe7475a2 100644 --- a/tag.go +++ b/tag.go @@ -103,10 +103,7 @@ func NewTag(s string) (Tag, error) { } } - slice := strings.Split(s, ":") - tagPair.Key = slice[0] - tagPair.Value = slice[1] - + tagPair.Key, tagPair.Value, _ = strings.Cut(s, ":") return tagPair, nil } diff --git a/task/backend/analytical_storage_test.go b/task/backend/analytical_storage_test.go index bc72fb5ef2..46825f461c 100644 --- a/task/backend/analytical_storage_test.go +++ b/task/backend/analytical_storage_test.go @@ -2,7 +2,6 @@ package backend_test import ( "context" - "io/ioutil" "os" "testing" "time" @@ -180,7 +179,7 @@ func newAnalyticalBackend(t *testing.T, orgSvc influxdb.OrganizationService, buc // Mostly copied out of cmd/influxd/main.go. logger := zaptest.NewLogger(t) - rootDir, err := ioutil.TempDir("", "task-logreaderwriter-") + rootDir, err := os.MkdirTemp("", "task-logreaderwriter-") if err != nil { t.Fatal(err) } diff --git a/task/backend/read_table_test.go b/task/backend/read_table_test.go index f192373994..4361f956d0 100644 --- a/task/backend/read_table_test.go +++ b/task/backend/read_table_test.go @@ -2,7 +2,7 @@ package backend import ( "bytes" - "io/ioutil" + "io" "testing" "github.com/influxdata/flux/csv" @@ -18,7 +18,7 @@ func TestReadTable(t *testing.T) { ,,0,2019-07-23T20:06:24.369913228Z,2019-07-23T20:11:24.369913228Z,2019-07-23T20:06:40.215226536Z,0432e57782b51000,2019-07-23T20:06:40.284116882Z,"[{""runID"":""04341bb4543a1000"",""time"":""2019-07-23T20:06:40.210364486Z"",""message"":""Started task from script: \""option v = {timeRangeStart: -1h, timeRangeStop: now(), windowPeriod: 15000ms}\\noption task = {name: \\\""howdy\\\"", every: 10s}\\n\\nfrom(bucket: \\\""goller+acc1's Bucket\\\"")\\n\\t|\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\\n\\t|\u003e filter(fn: (r) =\u003e\\n\\t\\t(r._measurement == \\\""disk\\\""))\\n\\t|\u003e filter(fn: (r) =\u003e\\n\\t\\t(r._field == \\\""free\\\""))\\n\\t|\u003e filter(fn: (r) =\u003e\\n\\t\\t(r.device == \\\""disk1s1\\\""))\\n\\t|\u003e aggregateWindow(every: v.windowPeriod, fn: mean)\\n\\t|\u003e yield(name: \\\""mean\\\"")\\n\\t|\u003e to(bucket: \\\""goller+acc1's Bucket\\\"", org: \\\""goller+acc1@gmail.com\\\"")\""""},{""runID"":""04341bb4543a1000"",""time"":""2019-07-23T20:06:40.277078243Z"",""message"":""Run failed to execute: panic: column _value:float is not of type int""},{""runID"":""04341bb4543a1000"",""time"":""2019-07-23T20:06:40.280158006Z"",""message"":""Failed""}]",04341bb4543a1000,2019-07-23T20:06:40Z,2019-07-23T20:06:40.215226536Z,failed`) decoder := csv.NewMultiResultDecoder(csv.ResultDecoderConfig{}) - itr, err := decoder.Decode(ioutil.NopCloser(bytes.NewReader(encoded))) + itr, err := decoder.Decode(io.NopCloser(bytes.NewReader(encoded))) if err != nil { t.Fatalf("got error decoding csv: %v", err) } diff --git a/telemetry/push.go b/telemetry/push.go index 71873063ff..495d4782ee 100644 --- a/telemetry/push.go +++ b/telemetry/push.go @@ -5,7 +5,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "net/http" "time" @@ -90,7 +89,7 @@ func (p *Pusher) push(ctx context.Context) error { defer res.Body.Close() if res.StatusCode != http.StatusAccepted { - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) return fmt.Errorf("unable to POST metrics; received status %s: %s", http.StatusText(res.StatusCode), body) } return nil diff --git a/telemetry/push_test.go b/telemetry/push_test.go index ab5182bd2f..4a7f26b77e 100644 --- a/telemetry/push_test.go +++ b/telemetry/push_test.go @@ -4,7 +4,7 @@ import ( "bytes" "context" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -114,7 +114,7 @@ func TestPusher_Push(t *testing.T) { return } got.Method = r.Method - got.Body, _ = ioutil.ReadAll(r.Body) + got.Body, _ = io.ReadAll(r.Body) w.WriteHeader(tt.status) }), ) diff --git a/tenant/http_handler_urm_test.go b/tenant/http_handler_urm_test.go index bcc9d38e4a..36040dadd2 100644 --- a/tenant/http_handler_urm_test.go +++ b/tenant/http_handler_urm_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -203,7 +203,7 @@ func TestUserResourceMappingService_GetMembersHandler(t *testing.T) { } // check response content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. GetMembersHandler() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) } @@ -355,7 +355,7 @@ func TestUserResourceMappingService_PostMembersHandler(t *testing.T) { t.Fatal(err) } content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. PostMembersHandler() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/testing/util.go b/testing/util.go index 11ebcd95c7..47147bfdc3 100644 --- a/testing/util.go +++ b/testing/util.go @@ -2,7 +2,6 @@ package testing import ( "context" - "io/ioutil" "os" "strings" "testing" @@ -20,7 +19,7 @@ import ( ) func NewTestBoltStore(t *testing.T) (kv.SchemaStore, func()) { - f, err := ioutil.TempFile("", "influxdata-bolt-") + f, err := os.CreateTemp("", "influxdata-bolt-") require.NoError(t, err, "unable to create temporary boltdb file") require.NoError(t, f.Close()) diff --git a/tests/client.go b/tests/client.go index 26f1e721d9..72bebdb648 100644 --- a/tests/client.go +++ b/tests/client.go @@ -3,7 +3,7 @@ package tests import ( "bytes" "context" - "io/ioutil" + "io" "net/http" "strings" "testing" @@ -101,7 +101,7 @@ func (c *Client) WriteBatch(points string) error { func (c *Client) QueryFlux(org, query string) (string, error) { var csv string csvResp := func(resp *http.Response) error { - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return err } diff --git a/toml/toml.go b/toml/toml.go index 86ef3ec189..931aaf92ab 100644 --- a/toml/toml.go +++ b/toml/toml.go @@ -149,7 +149,7 @@ func applyEnvOverrides(getenv func(string) string, prefix string, spec reflect.V element := spec // If spec is a named type and is addressable, // check the address to see if it implements encoding.TextUnmarshaler. - if spec.Kind() != reflect.Ptr && spec.Type().Name() != "" && spec.CanAddr() { + if spec.Kind() != reflect.Pointer && spec.Type().Name() != "" && spec.CanAddr() { v := spec.Addr() if u, ok := v.Interface().(encoding.TextUnmarshaler); ok { value := getenv(prefix) @@ -157,7 +157,7 @@ func applyEnvOverrides(getenv func(string) string, prefix string, spec reflect.V } } // If we have a pointer, dereference it - if spec.Kind() == reflect.Ptr { + if spec.Kind() == reflect.Pointer { element = spec.Elem() } @@ -251,7 +251,7 @@ func applyEnvOverrides(getenv func(string) string, prefix string, spec reflect.V } // If it's a sub-config, recursively apply - if field.Kind() == reflect.Struct || field.Kind() == reflect.Ptr || + if field.Kind() == reflect.Struct || field.Kind() == reflect.Pointer || field.Kind() == reflect.Slice || field.Kind() == reflect.Array { if err := applyEnvOverrides(getenv, envKey, field, fieldName); err != nil { return err diff --git a/tools.go b/tools.go index b22c0fb751..d9c3385049 100644 --- a/tools.go +++ b/tools.go @@ -1,5 +1,4 @@ //go:build tools -// +build tools package influxdb diff --git a/tools/tmpl/main.go b/tools/tmpl/main.go index 4f44aafe09..f8662e8b6e 100644 --- a/tools/tmpl/main.go +++ b/tools/tmpl/main.go @@ -6,7 +6,6 @@ import ( "flag" "fmt" "go/format" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -104,7 +103,7 @@ func main() { } func mustReadAll(path string) []byte { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { errExit(err.Error()) } @@ -164,7 +163,7 @@ func process(data interface{}, specs []pathSpec) { } } - ioutil.WriteFile(spec.out, generated, fileMode(spec.in)) + os.WriteFile(spec.out, generated, fileMode(spec.in)) } } diff --git a/tsdb/engine/tsm1/engine.go b/tsdb/engine/tsm1/engine.go index e62c19cbfc..0e79081a7c 100644 --- a/tsdb/engine/tsm1/engine.go +++ b/tsdb/engine/tsm1/engine.go @@ -3110,12 +3110,8 @@ func BlockTypeToInfluxQLDataType(typ byte) influxql.DataType { return blockToFie // SeriesAndFieldFromCompositeKey returns the series key and the field key extracted from the composite key. func SeriesAndFieldFromCompositeKey(key []byte) ([]byte, []byte) { - sep := bytes.Index(key, keyFieldSeparatorBytes) - if sep == -1 { - // No field??? - return key, nil - } - return key[:sep], key[sep+len(keyFieldSeparator):] + series, field, _ := bytes.Cut(key, keyFieldSeparatorBytes) + return series, field } func varRefSliceContains(a []influxql.VarRef, v string) bool { diff --git a/tsdb/engine/tsm1/mmap_unix.go b/tsdb/engine/tsm1/mmap_unix.go index 53883289ec..0fa303cb42 100644 --- a/tsdb/engine/tsm1/mmap_unix.go +++ b/tsdb/engine/tsm1/mmap_unix.go @@ -1,5 +1,4 @@ //go:build !windows && !plan9 -// +build !windows,!plan9 package tsm1 diff --git a/tsdb/engine/tsm1/predicate.go b/tsdb/engine/tsm1/predicate.go index de034f25e7..17574efab0 100644 --- a/tsdb/engine/tsm1/predicate.go +++ b/tsdb/engine/tsm1/predicate.go @@ -607,16 +607,10 @@ func predicateEval(comp datatypes.Node_Comparison, left, right []byte, rightReg // remainder in rest. it assumes there are no escaped characters in the series. func predicatePopTag(series []byte) (tag, value []byte, rest []byte) { // find the first ',' - i := bytes.IndexByte(series, ',') - if i >= 0 && i < len(series) { - series, rest = series[:i], series[i+1:] - } + series, rest, _ = bytes.Cut(series, []byte(",")) // find the first '=' - j := bytes.IndexByte(series, '=') - if j >= 0 && j < len(series) { - tag, value = series[:j], series[j+1:] - } + tag, value, _ = bytes.Cut(series, []byte("=")) return tag, value, rest } diff --git a/tsdb/index/tsi1/index_test.go b/tsdb/index/tsi1/index_test.go index 5e68efc79b..d4895099db 100644 --- a/tsdb/index/tsi1/index_test.go +++ b/tsdb/index/tsi1/index_test.go @@ -3,7 +3,7 @@ package tsi1_test import ( "compress/gzip" "fmt" - "io/ioutil" + "io" "os" "path/filepath" "reflect" @@ -261,7 +261,7 @@ func TestIndex_Open(t *testing.T) { } // Log the MANIFEST file. - data, err := ioutil.ReadFile(mpath) + data, err := os.ReadFile(mpath) if err != nil { panic(err) } @@ -717,7 +717,7 @@ func BenchmarkIndex_CreateSeriesListIfNotExists(b *testing.B) { b.Fatal(err) } - data, err := ioutil.ReadAll(gzr) + data, err := io.ReadAll(gzr) if err != nil { b.Fatal(err) } @@ -798,7 +798,7 @@ func BenchmarkIndex_ConcurrentWriteQuery(b *testing.B) { b.Fatal(err) } - data, err := ioutil.ReadAll(gzr) + data, err := io.ReadAll(gzr) if err != nil { b.Fatal(err) } diff --git a/tsdb/index/tsi1/log_file_test.go b/tsdb/index/tsi1/log_file_test.go index e2b0007ebb..0e15cfe53e 100644 --- a/tsdb/index/tsi1/log_file_test.go +++ b/tsdb/index/tsi1/log_file_test.go @@ -3,7 +3,6 @@ package tsi1_test import ( "bytes" "fmt" - "io/ioutil" "math/rand" "os" "path/filepath" @@ -286,14 +285,14 @@ func TestLogFile_Open(t *testing.T) { } // Corrupt last entry. - buf, err := ioutil.ReadFile(f.LogFile.Path()) + buf, err := os.ReadFile(f.LogFile.Path()) if err != nil { t.Fatal(err) } buf[len(buf)-1] = 0 // Overwrite file with corrupt entry and reopen. - if err := ioutil.WriteFile(f.LogFile.Path(), buf, 0666); err != nil { + if err := os.WriteFile(f.LogFile.Path(), buf, 0666); err != nil { t.Fatal(err) } else if err := f.LogFile.Open(); err != nil { t.Fatal(err) @@ -374,7 +373,7 @@ type LogFile struct { // NewLogFile returns a new instance of LogFile with a temporary file path. func NewLogFile(sfile *tsdb.SeriesFile) *LogFile { - file, err := ioutil.TempFile("", "tsi1-log-file-") + file, err := os.CreateTemp("", "tsi1-log-file-") if err != nil { panic(err) } diff --git a/tsdb/index/tsi1/partition.go b/tsdb/index/tsi1/partition.go index 552a35cb2f..3ecaac126c 100644 --- a/tsdb/index/tsi1/partition.go +++ b/tsdb/index/tsi1/partition.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "os" "path/filepath" "regexp" @@ -1384,7 +1383,7 @@ func (m *Manifest) Write() (int64, error) { } buf = append(buf, '\n') - if err := ioutil.WriteFile(m.path, buf, 0666); err != nil { + if err := os.WriteFile(m.path, buf, 0666); err != nil { return 0, err } return int64(len(buf)), nil @@ -1393,7 +1392,7 @@ func (m *Manifest) Write() (int64, error) { // ReadManifestFile reads a manifest from a file path and returns the Manifest, // the size of the manifest on disk, and any error if appropriate. func ReadManifestFile(path string) (*Manifest, int64, error) { - buf, err := ioutil.ReadFile(path) + buf, err := os.ReadFile(path) if err != nil { return nil, 0, err } diff --git a/tsdb/index/tsi1/partition_test.go b/tsdb/index/tsi1/partition_test.go index 0c0dbdc4e2..3aff845446 100644 --- a/tsdb/index/tsi1/partition_test.go +++ b/tsdb/index/tsi1/partition_test.go @@ -2,7 +2,6 @@ package tsi1_test import ( "fmt" - "io/ioutil" "os" "path/filepath" "testing" @@ -53,7 +52,7 @@ func TestPartition_Open(t *testing.T) { } // Log the MANIFEST file. - data, err := ioutil.ReadFile(mpath) + data, err := os.ReadFile(mpath) if err != nil { panic(err) } diff --git a/tsdb/index/tsi1/tsi1_test.go b/tsdb/index/tsi1/tsi1_test.go index 6e09bfffa2..64afcae4f4 100644 --- a/tsdb/index/tsi1/tsi1_test.go +++ b/tsdb/index/tsi1/tsi1_test.go @@ -2,7 +2,6 @@ package tsi1_test import ( "bytes" - "io/ioutil" "os" "path/filepath" "reflect" @@ -258,7 +257,7 @@ func (itr *SeriesIDIterator) Next() (elem tsdb.SeriesIDElem) { // MustTempDir returns a temporary directory. Panic on error. func MustTempDir() string { - path, err := ioutil.TempDir("", "tsi-") + path, err := os.MkdirTemp("", "tsi-") if err != nil { panic(err) } @@ -289,7 +288,7 @@ type SeriesFile struct { // NewSeriesFile returns a new instance of SeriesFile with a temporary file path. func NewSeriesFile() *SeriesFile { - dir, err := ioutil.TempDir("", "tsdb-series-file-") + dir, err := os.MkdirTemp("", "tsdb-series-file-") if err != nil { panic(err) } diff --git a/tsdb/series_file_test.go b/tsdb/series_file_test.go index 580d167bf4..b469bf4efa 100644 --- a/tsdb/series_file_test.go +++ b/tsdb/series_file_test.go @@ -3,7 +3,6 @@ package tsdb_test import ( "bytes" "fmt" - "io/ioutil" "os" "path" "testing" @@ -321,7 +320,7 @@ type SeriesFile struct { // NewSeriesFile returns a new instance of SeriesFile with a temporary file path. func NewSeriesFile() *SeriesFile { - dir, err := ioutil.TempDir("", "tsdb-series-file-") + dir, err := os.MkdirTemp("", "tsdb-series-file-") if err != nil { panic(err) } @@ -338,7 +337,7 @@ func NewBrokenSeriesFile(content []byte) *SeriesFile { if _, err := os.Stat(segPath); os.IsNotExist(err) { panic(err) } - err := ioutil.WriteFile(segPath, content, 0777) + err := os.WriteFile(segPath, content, 0777) if err != nil { panic(err) } diff --git a/tsdb/series_partition.go b/tsdb/series_partition.go index 63ad90fc85..7dc433ffc5 100644 --- a/tsdb/series_partition.go +++ b/tsdb/series_partition.go @@ -5,7 +5,6 @@ import ( "encoding/binary" "errors" "fmt" - "io/ioutil" "os" "path/filepath" "sync" @@ -102,18 +101,18 @@ func (p *SeriesPartition) Open() error { } func (p *SeriesPartition) openSegments() error { - fis, err := ioutil.ReadDir(p.path) + des, err := os.ReadDir(p.path) if err != nil { return err } - for _, fi := range fis { - segmentID, err := ParseSeriesSegmentFilename(fi.Name()) + for _, de := range des { + segmentID, err := ParseSeriesSegmentFilename(de.Name()) if err != nil { continue } - segment := NewSeriesSegment(segmentID, filepath.Join(p.path, fi.Name())) + segment := NewSeriesSegment(segmentID, filepath.Join(p.path, de.Name())) if err := segment.Open(); err != nil { return err } diff --git a/tsdb/shard.go b/tsdb/shard.go index 067b206e37..10254d1e18 100644 --- a/tsdb/shard.go +++ b/tsdb/shard.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "os" "path/filepath" "regexp" @@ -2213,7 +2212,7 @@ func (fs *MeasurementFieldSet) load() error { } var pb internal.MeasurementFieldSet - b, err := ioutil.ReadAll(fd) + b, err := io.ReadAll(fd) if err != nil { return err } diff --git a/tsdb/shard_internal_test.go b/tsdb/shard_internal_test.go index 3a570626dd..71d6acdd78 100644 --- a/tsdb/shard_internal_test.go +++ b/tsdb/shard_internal_test.go @@ -3,7 +3,6 @@ package tsdb import ( "context" "fmt" - "io/ioutil" "os" "path/filepath" "regexp" @@ -337,7 +336,7 @@ func NewTempShard(tb testing.TB, index string) *TempShard { tb.Helper() // Create temporary path for data and WAL. - dir, err := ioutil.TempDir("", "influxdb-tsdb-") + dir, err := os.MkdirTemp("", "influxdb-tsdb-") if err != nil { panic(err) } diff --git a/tsdb/shard_test.go b/tsdb/shard_test.go index eb682c384f..b96f91c614 100644 --- a/tsdb/shard_test.go +++ b/tsdb/shard_test.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "fmt" - "io/ioutil" "math" "os" "path/filepath" @@ -32,7 +31,7 @@ import ( ) func TestShardWriteAndIndex(t *testing.T) { - tmpDir, _ := ioutil.TempDir("", "shard_test") + tmpDir, _ := os.MkdirTemp("", "shard_test") defer os.RemoveAll(tmpDir) tmpShard := filepath.Join(tmpDir, "shard") tmpWal := filepath.Join(tmpDir, "wal") @@ -101,7 +100,7 @@ func TestShardWriteAndIndex(t *testing.T) { } func TestShardRebuildIndex(t *testing.T) { - tmpDir, _ := ioutil.TempDir("", "shard_test") + tmpDir, _ := os.MkdirTemp("", "shard_test") defer os.RemoveAll(tmpDir) tmpShard := filepath.Join(tmpDir, "shard") tmpWal := filepath.Join(tmpDir, "wal") @@ -179,7 +178,7 @@ func TestShardRebuildIndex(t *testing.T) { } func TestShard_Open_CorruptFieldsIndex(t *testing.T) { - tmpDir, _ := ioutil.TempDir("", "shard_test") + tmpDir, _ := os.MkdirTemp("", "shard_test") defer os.RemoveAll(tmpDir) tmpShard := filepath.Join(tmpDir, "shard") tmpWal := filepath.Join(tmpDir, "wal") @@ -229,7 +228,7 @@ func TestShard_Open_CorruptFieldsIndex(t *testing.T) { } func TestWriteTimeTag(t *testing.T) { - tmpDir, _ := ioutil.TempDir("", "shard_test") + tmpDir, _ := os.MkdirTemp("", "shard_test") defer os.RemoveAll(tmpDir) tmpShard := filepath.Join(tmpDir, "shard") tmpWal := filepath.Join(tmpDir, "wal") @@ -279,7 +278,7 @@ func TestWriteTimeTag(t *testing.T) { } func TestWriteTimeField(t *testing.T) { - tmpDir, _ := ioutil.TempDir("", "shard_test") + tmpDir, _ := os.MkdirTemp("", "shard_test") defer os.RemoveAll(tmpDir) tmpShard := filepath.Join(tmpDir, "shard") tmpWal := filepath.Join(tmpDir, "wal") @@ -314,7 +313,7 @@ func TestWriteTimeField(t *testing.T) { } func TestShardWriteAddNewField(t *testing.T) { - tmpDir, _ := ioutil.TempDir("", "shard_test") + tmpDir, _ := os.MkdirTemp("", "shard_test") defer os.RemoveAll(tmpDir) tmpShard := filepath.Join(tmpDir, "shard") tmpWal := filepath.Join(tmpDir, "wal") @@ -366,7 +365,7 @@ func TestShard_WritePoints_FieldConflictConcurrent(t *testing.T) { if testing.Short() || runtime.GOOS == "windows" { t.Skip("Skipping on short and windows") } - tmpDir, _ := ioutil.TempDir("", "shard_test") + tmpDir, _ := os.MkdirTemp("", "shard_test") defer os.RemoveAll(tmpDir) tmpShard := filepath.Join(tmpDir, "shard") tmpWal := filepath.Join(tmpDir, "wal") @@ -454,7 +453,7 @@ func TestShard_WritePoints_FieldConflictConcurrentQuery(t *testing.T) { if testing.Short() { t.Skip() } - tmpDir, _ := ioutil.TempDir("", "shard_test") + tmpDir, _ := os.MkdirTemp("", "shard_test") defer os.RemoveAll(tmpDir) tmpShard := filepath.Join(tmpDir, "shard") tmpWal := filepath.Join(tmpDir, "wal") @@ -604,7 +603,7 @@ func TestShard_WritePoints_FieldConflictConcurrentQuery(t *testing.T) { // Ensures that when a shard is closed, it removes any series meta-data // from the index. func TestShard_Close_RemoveIndex(t *testing.T) { - tmpDir, _ := ioutil.TempDir("", "shard_test") + tmpDir, _ := os.MkdirTemp("", "shard_test") defer os.RemoveAll(tmpDir) tmpShard := filepath.Join(tmpDir, "shard") tmpWal := filepath.Join(tmpDir, "wal") @@ -1642,7 +1641,7 @@ func TestMeasurementFieldSet_InvalidFormat(t *testing.T) { path := filepath.Join(dir, "fields.idx") - if err := ioutil.WriteFile(path, []byte{0, 0}, 0666); err != nil { + if err := os.WriteFile(path, []byte{0, 0}, 0666); err != nil { t.Fatalf("error writing fields.index: %v", err) } @@ -2090,7 +2089,7 @@ func benchmarkWritePointsExistingSeriesEqualBatches(b *testing.B, mCnt, tkCnt, t } func openShard(sfile *SeriesFile) (*tsdb.Shard, string, error) { - tmpDir, _ := ioutil.TempDir("", "shard_test") + tmpDir, _ := os.MkdirTemp("", "shard_test") tmpShard := filepath.Join(tmpDir, "shard") tmpWal := filepath.Join(tmpDir, "wal") opts := tsdb.NewEngineOptions() @@ -2228,7 +2227,7 @@ func NewShards(tb testing.TB, index string, n int) Shards { tb.Helper() // Create temporary path for data and WAL. - dir, err := ioutil.TempDir("", "influxdb-tsdb-") + dir, err := os.MkdirTemp("", "influxdb-tsdb-") if err != nil { panic(err) } @@ -2327,7 +2326,7 @@ func (sh *Shard) MustWritePointsString(s string) { } func MustTempDir() (string, func()) { - dir, err := ioutil.TempDir("", "shard-test") + dir, err := os.MkdirTemp("", "shard-test") if err != nil { panic(fmt.Sprintf("failed to create temp dir: %v", err)) } diff --git a/tsdb/store.go b/tsdb/store.go index 14daea49b2..4f65434280 100644 --- a/tsdb/store.go +++ b/tsdb/store.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "os" "path/filepath" "runtime" @@ -317,7 +316,7 @@ func (s *Store) loadShards(ctx context.Context) error { var n int // Determine how many shards we need to open by checking the store path. - dbDirs, err := ioutil.ReadDir(s.path) + dbDirs, err := os.ReadDir(s.path) if err != nil { return err } @@ -341,7 +340,7 @@ func (s *Store) loadShards(ctx context.Context) error { } // Load each retention policy within the database directory. - rpDirs, err := ioutil.ReadDir(dbPath) + rpDirs, err := os.ReadDir(dbPath) if err != nil { return err } @@ -363,7 +362,7 @@ func (s *Store) loadShards(ctx context.Context) error { continue } - shardDirs, err := ioutil.ReadDir(rpPath) + shardDirs, err := os.ReadDir(rpPath) if err != nil { return err } diff --git a/tsdb/store_test.go b/tsdb/store_test.go index c9d23ec2f2..b3b76fcc2e 100644 --- a/tsdb/store_test.go +++ b/tsdb/store_test.go @@ -6,7 +6,6 @@ import ( "context" "errors" "fmt" - "io/ioutil" "math" "math/rand" "os" @@ -2271,7 +2270,7 @@ type Store struct { func NewStore(tb testing.TB, index string) *Store { tb.Helper() - path, err := ioutil.TempDir("", "influxdb-tsdb-") + path, err := os.MkdirTemp("", "influxdb-tsdb-") if err != nil { panic(err) } diff --git a/v1/authorization/http_server_test.go b/v1/authorization/http_server_test.go index 3bcdde482f..5ea847ed82 100644 --- a/v1/authorization/http_server_test.go +++ b/v1/authorization/http_server_test.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "sort" @@ -233,7 +233,7 @@ func TestService_handlePostAuthorization(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Logf("headers: %v body: %s", res.Header, body) @@ -413,7 +413,7 @@ func TestService_handleGetAuthorization(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Logf("headers: %v body: %s", res.Header, body) @@ -753,7 +753,7 @@ func TestService_handleGetAuthorizations(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleGetAuthorizations() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) @@ -854,7 +854,7 @@ func TestService_handleDeleteAuthorization(t *testing.T) { res := w.Result() content := res.Header.Get("Content-Type") - body, _ := ioutil.ReadAll(res.Body) + body, _ := io.ReadAll(res.Body) if res.StatusCode != tt.wants.statusCode { t.Errorf("%q. handleDeleteAuthorization() = %v, want %v", tt.name, res.StatusCode, tt.wants.statusCode) diff --git a/v1/node.go b/v1/node.go index 68709edc30..b7c2e0daa9 100644 --- a/v1/node.go +++ b/v1/node.go @@ -3,7 +3,6 @@ package influxdb import ( "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "strconv" @@ -75,7 +74,7 @@ func (n *Node) Save() error { func upgradeNodeFile(path string) error { oldFile := filepath.Join(path, oldNodeFile) - b, err := ioutil.ReadFile(oldFile) + b, err := os.ReadFile(oldFile) if err != nil { if os.IsNotExist(err) { return nil @@ -88,7 +87,7 @@ func upgradeNodeFile(path string) error { } peers := []string{} - pb, err := ioutil.ReadFile(filepath.Join(path, peersFilename)) + pb, err := os.ReadFile(filepath.Join(path, peersFilename)) if err != nil { if os.IsNotExist(err) { return nil diff --git a/v1/services/meta/filestore/kv.go b/v1/services/meta/filestore/kv.go index 1f113f4d87..60ad86611e 100644 --- a/v1/services/meta/filestore/kv.go +++ b/v1/services/meta/filestore/kv.go @@ -3,7 +3,6 @@ package filestore import ( "context" "io" - "io/ioutil" "os" "path/filepath" "sync" @@ -106,7 +105,7 @@ func (s *KVStore) GetBatch(keys ...[]byte) (values [][]byte, err error) { } func (s *KVStore) get() ([]byte, error) { - if d, err := ioutil.ReadFile(s.full); os.IsNotExist(err) { + if d, err := os.ReadFile(s.full); os.IsNotExist(err) { return nil, kv.ErrKeyNotFound } else if err != nil { return nil, err diff --git a/vault/secret_test.go b/vault/secret_test.go index 364cd5a4e6..3cda473307 100644 --- a/vault/secret_test.go +++ b/vault/secret_test.go @@ -1,5 +1,4 @@ //go:build integration -// +build integration package vault_test