From 061f7658cc4cee6c3ece2a952af651b625bd7bad Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Wed, 14 Dec 2022 07:29:56 -0800 Subject: [PATCH] Chore: Upgrade to golang 1.19 (#585) --- .drone.yml | 14 +++++------ .golangci.toml | 4 ---- backend/data.go | 2 ++ backend/resource/httpadapter/handler_test.go | 4 ++-- backend/setup.go | 1 + build/common.go | 3 +-- build/utils/copy.go | 3 +-- build/utils/copy_test.go | 25 ++++++++++---------- build/utils/exists_test.go | 3 +-- data/arrow_test.go | 9 ++++--- data/field.go | 20 ++++++++++++---- data/field_type.go | 1 + data/frame.go | 6 +++-- data/frame_json_test.go | 16 +++++++------ data/frame_meta.go | 3 +++ data/frame_type.go | 9 +++---- data/framestruct/converter.go | 2 ++ data/labels.go | 1 + experimental/e2e/README.md | 3 +-- experimental/e2e/certificate_authority/ca.go | 12 ++++++---- experimental/e2e/config/types.go | 4 ++-- experimental/e2e/fixture/fixture.go | 4 ++-- experimental/e2e/fixture/fixture_test.go | 11 ++++----- experimental/e2e/proxy.go | 1 + experimental/e2e/proxy_test.go | 23 +++++++++--------- experimental/e2e/storage/har.go | 13 +++++----- experimental/e2e/storage/har_test.go | 3 +-- experimental/e2e/storage/openapi.go | 6 ++--- experimental/e2e/storage/openapi_test.go | 4 ++-- experimental/e2e/utils/http.go | 5 ++-- experimental/fileinfo.go | 10 ++++---- experimental/http_logger/http_logger.go | 6 ++--- experimental/http_logger/http_logger_test.go | 14 +++++------ experimental/rest_client.go | 4 ++-- experimental/sdata/numeric/multi.go | 20 ++++++++-------- go.mod | 12 +++++----- go.sum | 16 ++++++++----- 37 files changed, 158 insertions(+), 139 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4d5ceb35c..8ab2ca6b8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -16,17 +16,17 @@ trigger: steps: - name: build - image: grafana/grafana-plugin-ci:1.3.0-alpine + image: grafana/grafana-plugin-ci:1.6.1-alpine commands: - mage -v build - name: lint - image: grafana/grafana-plugin-ci:1.3.0-alpine + image: grafana/grafana-plugin-ci:1.6.1-alpine commands: - mage -v lint - name: test - image: grafana/grafana-plugin-ci:1.3.0-alpine + image: grafana/grafana-plugin-ci:1.6.1-alpine commands: - mage -v testRace --- @@ -44,22 +44,22 @@ trigger: steps: - name: build - image: grafana/grafana-plugin-ci:1.3.0-alpine + image: grafana/grafana-plugin-ci:1.6.1-alpine commands: - mage -v build - name: lint - image: grafana/grafana-plugin-ci:1.3.0-alpine + image: grafana/grafana-plugin-ci:1.6.1-alpine commands: - mage -v lint - name: test - image: grafana/grafana-plugin-ci:1.3.0-alpine + image: grafana/grafana-plugin-ci:1.6.1-alpine commands: - mage -v testRace --- kind: signature -hmac: 54a40860ed9a1a675f7605f96b02c8dbd1b25e769cb942a27a952425a9673ad4 +hmac: 329582f349b7f3a2bc25d2848d2bc3bd6232a66d1596e73b7c7317eac2a50d7e ... diff --git a/.golangci.toml b/.golangci.toml index 101d079d6..7d249c18f 100644 --- a/.golangci.toml +++ b/.golangci.toml @@ -18,7 +18,6 @@ ignore-words = ["unknwon"] disable-all = true enable = [ "bodyclose", - "deadcode", "depguard", "dogsled", "errcheck", @@ -26,7 +25,6 @@ enable = [ "goconst", "gocritic", "goimports", - "golint", "goprintffuncname", "gosec", "gosimple", @@ -37,12 +35,10 @@ enable = [ "rowserrcheck", "exportloopref", "staticcheck", - "structcheck", "stylecheck", "typecheck", "unconvert", "unused", - "varcheck", "whitespace", "gocyclo", "unparam", diff --git a/backend/data.go b/backend/data.go index a26afc70e..d747de17a 100644 --- a/backend/data.go +++ b/backend/data.go @@ -99,12 +99,14 @@ func NewQueryDataResponse() *QueryDataResponse { // Responses is a map of RefIDs (Unique Query ID) to DataResponses. // The QueryData method the QueryDataHandler method will set the RefId // property on the DataResponses' frames based on these RefIDs. +// //swagger:model type Responses map[string]DataResponse // DataResponse contains the results from a DataQuery. // A map of RefIDs (unique query identifiers) to this type makes up the Responses property of a QueryDataResponse. // The Error property is used to allow for partial success responses from the containing QueryDataResponse. +// //swagger:model type DataResponse struct { // The data returned from the Query. Each Frame repeats the RefID. diff --git a/backend/resource/httpadapter/handler_test.go b/backend/resource/httpadapter/handler_test.go index 155cce9fe..920644945 100644 --- a/backend/resource/httpadapter/handler_test.go +++ b/backend/resource/httpadapter/handler_test.go @@ -3,7 +3,7 @@ package httpadapter import ( "context" "encoding/json" - "io/ioutil" + "io" "net/http" "testing" @@ -70,7 +70,7 @@ func TestHttpResourceHandler(t *testing.T) { require.Equal(t, []string{"F"}, httpHandler.req.Header["X-Header-In-2"]) require.NotNil(t, httpHandler.req.Body) defer httpHandler.req.Body.Close() - actualBodyBytes, err := ioutil.ReadAll(httpHandler.req.Body) + actualBodyBytes, err := io.ReadAll(httpHandler.req.Body) require.NoError(t, err) var actualJSONMap map[string]interface{} err = json.Unmarshal(actualBodyBytes, &actualJSONMap) diff --git a/backend/setup.go b/backend/setup.go index cfe5e8a70..8ec418e51 100644 --- a/backend/setup.go +++ b/backend/setup.go @@ -59,6 +59,7 @@ func SetupPluginEnvironment(pluginID string) { r.HandleFunc("/debug/pprof/trace", pprof.Trace) go func() { + //nolint:gosec if err := http.ListenAndServe(portConfig, r); err != nil { Logger.Error("Error Running profiler: %s", err.Error()) } diff --git a/build/common.go b/build/common.go index a841f1072..94dbdfb15 100644 --- a/build/common.go +++ b/build/common.go @@ -4,7 +4,6 @@ import ( "bufio" "embed" "fmt" - "io/ioutil" "log" "os" "path/filepath" @@ -340,7 +339,7 @@ func e2eProxy(mode e2e.ProxyMode) error { // checkLinuxPtraceScope verifies that ptrace is configured as required. func checkLinuxPtraceScope() error { ptracePath := "/proc/sys/kernel/yama/ptrace_scope" - byteValue, err := ioutil.ReadFile(ptracePath) + byteValue, err := os.ReadFile(ptracePath) if err != nil { return fmt.Errorf("unable to read ptrace_scope: %w", err) } diff --git a/build/utils/copy.go b/build/utils/copy.go index 380dd3c99..b150b017d 100644 --- a/build/utils/copy.go +++ b/build/utils/copy.go @@ -3,7 +3,6 @@ package utils import ( "fmt" "io" - "io/ioutil" "os" "path" "path/filepath" @@ -105,7 +104,7 @@ func CopyRecursive(src, dst string) error { } } - entries, err := ioutil.ReadDir(src) + entries, err := os.ReadDir(src) if err != nil { return err } diff --git a/build/utils/copy_test.go b/build/utils/copy_test.go index ef82fa8ed..6ce3eb760 100644 --- a/build/utils/copy_test.go +++ b/build/utils/copy_test.go @@ -1,7 +1,6 @@ package utils import ( - "io/ioutil" "os" "path" "path/filepath" @@ -12,13 +11,13 @@ import ( ) func TestCopyFile(t *testing.T) { - src, err := ioutil.TempFile("", "") + src, err := os.CreateTemp("", "") require.NoError(t, err) defer os.RemoveAll(src.Name()) - err = ioutil.WriteFile(src.Name(), []byte("Contents"), 0600) + err = os.WriteFile(src.Name(), []byte("Contents"), 0600) require.NoError(t, err) - dst, err := ioutil.TempFile("", "") + dst, err := os.CreateTemp("", "") require.NoError(t, err) defer os.RemoveAll(dst.Name()) @@ -28,7 +27,7 @@ func TestCopyFile(t *testing.T) { // Test case where destination directory doesn't exist. func TestCopyFile_NonExistentDestDir(t *testing.T) { - src, err := ioutil.TempFile("", "") + src, err := os.CreateTemp("", "") require.NoError(t, err) defer os.RemoveAll(src.Name()) @@ -37,16 +36,16 @@ func TestCopyFile_NonExistentDestDir(t *testing.T) { } func TestCopyRecursive_NonExistentDest(t *testing.T) { - src, err := ioutil.TempDir("", "") + src, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(src) err = os.MkdirAll(path.Join(src, "data"), 0755) require.NoError(t, err) - err = ioutil.WriteFile(path.Join(src, "data", "file.txt"), []byte("Test"), 0600) + err = os.WriteFile(path.Join(src, "data", "file.txt"), []byte("Test"), 0600) require.NoError(t, err) - dstParent, err := ioutil.TempDir("", "") + dstParent, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(dstParent) @@ -59,16 +58,16 @@ func TestCopyRecursive_NonExistentDest(t *testing.T) { } func TestCopyRecursive_ExistentDest(t *testing.T) { - src, err := ioutil.TempDir("", "") + src, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(src) err = os.MkdirAll(path.Join(src, "data"), 0755) require.NoError(t, err) - err = ioutil.WriteFile(path.Join(src, "data", "file.txt"), []byte("Test"), 0600) + err = os.WriteFile(path.Join(src, "data", "file.txt"), []byte("Test"), 0600) require.NoError(t, err) - dst, err := ioutil.TempDir("", "") + dst, err := os.MkdirTemp("", "") require.NoError(t, err) defer os.RemoveAll(dst) @@ -106,9 +105,9 @@ func compareDirs(t *testing.T, src, dst string) { return nil } - srcData, err := ioutil.ReadFile(srcPath) + srcData, err := os.ReadFile(srcPath) require.NoError(t, err) - dstData, err := ioutil.ReadFile(dstPath) + dstData, err := os.ReadFile(dstPath) require.NoError(t, err) require.Equal(t, srcData, dstData) diff --git a/build/utils/exists_test.go b/build/utils/exists_test.go index 14b16265b..7c94b65a7 100644 --- a/build/utils/exists_test.go +++ b/build/utils/exists_test.go @@ -1,7 +1,6 @@ package utils import ( - "io/ioutil" "os" "testing" @@ -16,7 +15,7 @@ func TestExists_NonExistent(t *testing.T) { } func TestExists_Existent(t *testing.T) { - f, err := ioutil.TempFile("", "") + f, err := os.CreateTemp("", "") require.NoError(t, err) defer os.Remove(f.Name()) diff --git a/data/arrow_test.go b/data/arrow_test.go index 319b71f4d..f706446d4 100644 --- a/data/arrow_test.go +++ b/data/arrow_test.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "flag" - "io/ioutil" "math" "os" "path/filepath" @@ -300,12 +299,12 @@ func TestEncode(t *testing.T) { goldenFile := filepath.Join("testdata", "all_types.golden.arrow") if *update { - if err := ioutil.WriteFile(goldenFile, b, 0600); err != nil { + if err := os.WriteFile(goldenFile, b, 0600); err != nil { t.Fatal(err) } } - want, err := ioutil.ReadFile(goldenFile) + want, err := os.ReadFile(goldenFile) if err != nil { t.Fatal(err) } @@ -332,7 +331,7 @@ func TestEncode(t *testing.T) { func TestDecode(t *testing.T) { goldenFile := filepath.Join("testdata", "all_types.golden.arrow") - b, err := ioutil.ReadFile(goldenFile) + b, err := os.ReadFile(goldenFile) if err != nil { t.Fatal(err) } @@ -391,7 +390,7 @@ func TestFromRecord(t *testing.T) { } // Write golden data frame to file so we can read it back in via Record reader - fd, err := ioutil.TempFile("", "data-test-from-record") + fd, err := os.CreateTemp("", "data-test-from-record") require.NoError(t, err) name := fd.Name() defer os.Remove(name) diff --git a/data/field.go b/data/field.go index da5b31eb0..093227620 100644 --- a/data/field.go +++ b/data/field.go @@ -14,6 +14,7 @@ import ( // See NewField() for supported types. // // The slice data in the Field is a not exported, so methods on the Field are used to to manipulate its data. +// //swagger:model type Field struct { // Name is default identifier of the field. The name does not have to be unique, but the combination @@ -38,15 +39,24 @@ type Fields []*Field // NewField returns a instance of *Field. Supported types for values are: // // Integers: -// []int8, []*int8, []int16, []*int16, []int32, []*int32, []int64, []*int64 +// +// []int8, []*int8, []int16, []*int16, []int32, []*int32, []int64, []*int64 +// // Unsigned Integers: -// []uint8, []*uint8, []uint16, []*uint16, []uint32, []*uint32, []uint64, []*uint64 +// +// []uint8, []*uint8, []uint16, []*uint16, []uint32, []*uint32, []uint64, []*uint64 +// // Floats: -// []float32, []*float32, []float64, []*float64 +// +// []float32, []*float32, []float64, []*float64 +// // String, Bool, and Time: -// []string, []*string, []bool, []*bool, []time.Time, and []*time.Time. +// +// []string, []*string, []bool, []*bool, []time.Time, and []*time.Time. +// // JSON: -// []json.RawMessage, []*json.RawMessage +// +// []json.RawMessage, []*json.RawMessage // // If an unsupported values type is passed, NewField will panic. // nolint:gocyclo diff --git a/data/field_type.go b/data/field_type.go index 128c3a108..ba328d8c4 100644 --- a/data/field_type.go +++ b/data/field_type.go @@ -253,6 +253,7 @@ func (p FieldType) NonNullableType() FieldType { } // FieldTypeFromItemTypeString returns a field type from the current string +// //nolint:goconst,gocyclo func FieldTypeFromItemTypeString(s string) (FieldType, bool) { switch s { diff --git a/data/frame.go b/data/frame.go index a9d0ebb0f..1a29429ed 100644 --- a/data/frame.go +++ b/data/frame.go @@ -30,6 +30,7 @@ import ( // // A Frame is a general data container for Grafana. A Frame can be table data // or time series data depending on its content and field types. +// //swagger:model type Frame struct { // Name is used in some Grafana visualizations. @@ -68,6 +69,7 @@ func (f *Frame) MarshalJSON() ([]byte, error) { // Frames is a slice of Frame pointers. // It is the main data container within a backend.DataResponse. +// //swagger:model type Frames []*Frame @@ -491,9 +493,9 @@ func (f *Frame) StringTable(maxFields, maxRows int) (string, error) { switch { case f.Fields[colIdx].Type() == FieldTypeJSON: - sRow[colIdx] = fmt.Sprintf("%s", v.(json.RawMessage)) + sRow[colIdx] = string(v.(json.RawMessage)) case f.Fields[colIdx].Type() == FieldTypeNullableJSON: - sRow[colIdx] = fmt.Sprintf("%s", *v.(*json.RawMessage)) + sRow[colIdx] = string(*v.(*json.RawMessage)) default: sRow[colIdx] = fmt.Sprintf("%v", val) } diff --git a/data/frame_json_test.go b/data/frame_json_test.go index a9965a5ff..2b9e0d43a 100644 --- a/data/frame_json_test.go +++ b/data/frame_json_test.go @@ -3,7 +3,6 @@ package data_test import ( "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -12,6 +11,8 @@ import ( "text/template" jsoniter "github.com/json-iterator/go" + "golang.org/x/text/cases" + "golang.org/x/text/language" "github.com/google/go-cmp/cmp" "github.com/grafana/grafana-plugin-sdk-go/data" @@ -43,11 +44,11 @@ func TestGoldenFrameJSON(t *testing.T) { goldenFile := filepath.Join("testdata", "all_types.golden.json") if _, err := os.Stat(goldenFile); os.IsNotExist(err) { - _ = ioutil.WriteFile(goldenFile, b, 0600) + _ = os.WriteFile(goldenFile, b, 0600) assert.FailNow(t, "wrote golden file") } - b, err = ioutil.ReadFile(goldenFile) + b, err = os.ReadFile(goldenFile) require.NoError(t, err) strG := string(b) @@ -290,12 +291,13 @@ func readNullable{{.Type}}VectorJSON(iter *jsoniter.Iterator, size int) (*nullab } ` + caser := cases.Title(language.English) // switch col.DataType().ID() { // // case arrow.STRING: // // ent := writeArrowSTRING(stream, col) for _, tstr := range types { - tname := strings.Title(tstr) + tname := caser.String(tstr) tuppr := strings.ToUpper(tstr) fmt.Printf(" case arrow." + tuppr + ":\n\t\tent = writeArrowData" + tname + "(stream, col)\n") @@ -313,8 +315,8 @@ func readNullable{{.Type}}VectorJSON(iter *jsoniter.Iterator, size int) (*nullab Typen string HasSpecialEntities bool }{ - Type: strings.Title(tstr), - Typex: strings.Title(typex), + Type: caser.String(tstr), + Typex: caser.String(typex), Typen: tstr, HasSpecialEntities: hasSpecialEntities, } @@ -326,7 +328,7 @@ func readNullable{{.Type}}VectorJSON(iter *jsoniter.Iterator, size int) (*nullab } for _, tstr := range types { - tname := strings.Title(tstr) + tname := caser.String(tstr) fmt.Printf(" case FieldType" + tname + ": return read" + tname + "VectorJSON(iter, size)\n") fmt.Printf(" case FieldTypeNullable" + tname + ": return readNullable" + tname + "VectorJSON(iter, size)\n") } diff --git a/data/frame_meta.go b/data/frame_meta.go index 605e46e78..401799f95 100644 --- a/data/frame_meta.go +++ b/data/frame_meta.go @@ -9,6 +9,7 @@ import ( // https://github.com/grafana/grafana/blob/master/packages/grafana-data/src/types/data.ts#L11 // NOTE -- in javascript this can accept any `[key: string]: any;` however // this interface only exposes the values we want to be exposed +// //swagger:model type FrameMeta struct { // Type asserts that the frame matches a known type structure @@ -76,6 +77,8 @@ const ( ) // DataTopic is used to identify which topic the frame should be assigned to. +// +//nolint:revive type DataTopic string // FrameMetaFromJSON creates a QueryResultMeta from a json string diff --git a/data/frame_type.go b/data/frame_type.go index 4fdafbeba..890ce305d 100644 --- a/data/frame_type.go +++ b/data/frame_type.go @@ -38,11 +38,12 @@ const FrameTypeTimeSeriesMulti FrameType = "timeseries-multi" // FrameTypeDirectoryListing represents the items in a directory // field[0]: -// * name -// * new paths can be constructed from the parent path + separator + name +// - name +// - new paths can be constructed from the parent path + separator + name +// // field[1]: -// * media-type -// * when "directory" it can be nested +// - media-type +// - when "directory" it can be nested const FrameTypeDirectoryListing FrameType = "directory-listing" // FrameTypeTable represents an arbitrary table structure with no constraints. diff --git a/data/framestruct/converter.go b/data/framestruct/converter.go index 28cfcb478..04d17efc1 100644 --- a/data/framestruct/converter.go +++ b/data/framestruct/converter.go @@ -63,6 +63,8 @@ func ToDataFrames(name string, toConvert interface{}, opts ...FramestructOption) type FieldConverter func(interface{}) (interface{}, error) // FramestructOption takes a converter and applies some configuration to it +// +//nolint:revive type FramestructOption func(cr *converter) // WithConverterFor configures a FieldConverter for a field with the name diff --git a/data/labels.go b/data/labels.go index f7438e637..5c194d2bc 100644 --- a/data/labels.go +++ b/data/labels.go @@ -11,6 +11,7 @@ import ( ) // Labels are used to add metadata to an object. The JSON will always be sorted keys +// //swagger:model FrameLabels type Labels map[string]string diff --git a/experimental/e2e/README.md b/experimental/e2e/README.md index 7ea613a82..b8ef3c909 100644 --- a/experimental/e2e/README.md +++ b/experimental/e2e/README.md @@ -239,7 +239,6 @@ import ( build "github.com/grafana/grafana-plugin-sdk-go/build" "bytes" - "io/ioutil" "net/http" "github.com/grafana/grafana-plugin-sdk-go/experimental/e2e" @@ -285,7 +284,7 @@ func CustomE2E() error { return &http.Response{ StatusCode: http.StatusNotFound, Header: http.Header{}, - Body: ioutil.NopCloser(bytes.NewBufferString("Not found")), + Body: io.NopCloser(bytes.NewBufferString("Not found")), } } return nil diff --git a/experimental/e2e/certificate_authority/ca.go b/experimental/e2e/certificate_authority/ca.go index 2c9ce9437..758477250 100644 --- a/experimental/e2e/certificate_authority/ca.go +++ b/experimental/e2e/certificate_authority/ca.go @@ -2,17 +2,19 @@ package ca import ( _ "embed" // Needed for embedding the CA certificate and key + "os" "crypto/tls" - "io/ioutil" ) -//go:embed grafana-e2e-ca.pem // CACertificate Certificate Authority certificate used by the proxy. +// +//go:embed grafana-e2e-ca.pem var CACertificate []byte -//go:embed grafana-e2e-ca.key.pem // CAKey Certificate Authority private key used by the proxy. +// +//go:embed grafana-e2e-ca.key.pem var CAKey []byte // Loads the CA key pair from the provided paths, and falls back to the default key pair if paths are not provided. @@ -29,12 +31,12 @@ func GetCertificate(certPath, keyPath string) (tls.Certificate, error) { // Loads the CA key pair from the provided paths. func LoadKeyPair(certPath, keyPath string) ([]byte, []byte, error) { - cert, err := ioutil.ReadFile(certPath) + cert, err := os.ReadFile(certPath) if err != nil { return []byte{}, []byte{}, err } - key, err := ioutil.ReadFile(keyPath) + key, err := os.ReadFile(keyPath) if err != nil { return []byte{}, []byte{}, err } diff --git a/experimental/e2e/config/types.go b/experimental/e2e/config/types.go index 0533c6f09..d46400e86 100644 --- a/experimental/e2e/config/types.go +++ b/experimental/e2e/config/types.go @@ -2,7 +2,7 @@ package config import ( "encoding/json" - "io/ioutil" + "os" ) // Config is the configuration for the proxy. @@ -49,7 +49,7 @@ func LoadConfig(path string) (*Config, error) { path = "proxy.json" } - raw, err := ioutil.ReadFile(path) + raw, err := os.ReadFile(path) if err != nil { return &Config{ Storage: []*StorageConfig{{ diff --git a/experimental/e2e/fixture/fixture.go b/experimental/e2e/fixture/fixture.go index e64adf70e..4e76f87d7 100644 --- a/experimental/e2e/fixture/fixture.go +++ b/experimental/e2e/fixture/fixture.go @@ -2,7 +2,7 @@ package fixture import ( "bytes" - "io/ioutil" + "io" "net/http" "github.com/grafana/grafana-plugin-sdk-go/experimental/e2e/storage" @@ -87,7 +87,7 @@ func DefaultProcessRequest(req *http.Request) *http.Request { if err != nil { return processedReq } - req.Body = ioutil.NopCloser(bytes.NewBuffer(b)) + req.Body = io.NopCloser(bytes.NewBuffer(b)) return processedReq } diff --git a/experimental/e2e/fixture/fixture_test.go b/experimental/e2e/fixture/fixture_test.go index f81eb16c7..18b9cdac1 100644 --- a/experimental/e2e/fixture/fixture_test.go +++ b/experimental/e2e/fixture/fixture_test.go @@ -3,7 +3,6 @@ package fixture_test import ( "bytes" "io" - "io/ioutil" "net/http" "strings" "testing" @@ -149,7 +148,7 @@ func TestFixtureMatch(t *testing.T) { f := fixture.NewFixture(store) req, resp := setupFixture() defer resp.Body.Close() - req.Body = ioutil.NopCloser(bytes.NewBufferString("foo")) + req.Body = io.NopCloser(bytes.NewBufferString("foo")) res := f.Match(req) // nolint:bodyclose require.Nil(t, res) }) @@ -184,7 +183,7 @@ func TestFixtureDelete(t *testing.T) { } func setupFixture() (*http.Request, *http.Response) { - req, err := http.NewRequest("POST", "http://example.com", ioutil.NopCloser(strings.NewReader("test"))) + req, err := http.NewRequest("POST", "http://example.com", io.NopCloser(strings.NewReader("test"))) if err != nil { panic(err) } @@ -192,7 +191,7 @@ func setupFixture() (*http.Request, *http.Response) { res := &http.Response{ StatusCode: 200, Header: make(http.Header), - Body: ioutil.NopCloser(strings.NewReader("{\"foo\":\"bar\"}")), + Body: io.NopCloser(strings.NewReader("{\"foo\":\"bar\"}")), } return req, res } @@ -210,13 +209,13 @@ func newFakeStorage() *fakeStorage { } func (s *fakeStorage) Add(req *http.Request, res *http.Response) error { - resBody, err := ioutil.ReadAll(res.Body) + resBody, err := io.ReadAll(res.Body) if err != nil { return err } res.Body = io.NopCloser(bytes.NewBuffer(resBody)) resCopy := *res - resCopy.Body = ioutil.NopCloser(bytes.NewBuffer(resBody)) + resCopy.Body = io.NopCloser(bytes.NewBuffer(resBody)) s.entries = append(s.entries, &storage.Entry{ Request: req, Response: &resCopy, diff --git a/experimental/e2e/proxy.go b/experimental/e2e/proxy.go index 37017e2af..2234f5b88 100644 --- a/experimental/e2e/proxy.go +++ b/experimental/e2e/proxy.go @@ -89,6 +89,7 @@ func NewProxy(mode ProxyMode, fixture []*fixture.Fixture, config *config.Config) // Start starts the proxy server. func (p *Proxy) Start() error { fmt.Println("Starting proxy", "mode", p.Mode.String(), "addr", p.Config.Address) + //nolint:gosec return http.ListenAndServe(p.Config.Address, p.Server) } diff --git a/experimental/e2e/proxy_test.go b/experimental/e2e/proxy_test.go index c36546b8c..fe056fde3 100644 --- a/experimental/e2e/proxy_test.go +++ b/experimental/e2e/proxy_test.go @@ -4,7 +4,6 @@ import ( "bytes" "crypto/tls" "io" - "io/ioutil" "net/http" "net/http/httptest" "net/url" @@ -46,7 +45,7 @@ func TestProxy(t *testing.T) { require.Equal(t, "/foo", proxy.Fixtures[0].Entries()[0].Request.URL.Path) require.Equal(t, http.StatusOK, proxy.Fixtures[0].Entries()[0].Response.StatusCode) require.Equal(t, http.StatusOK, res.StatusCode) - resBody, err := ioutil.ReadAll(res.Body) + resBody, err := io.ReadAll(res.Body) require.NoError(t, err) require.Equal(t, "/foo", string(resBody)) }) @@ -61,7 +60,7 @@ func TestProxy(t *testing.T) { req.Header = make(http.Header) res := &http.Response{ StatusCode: http.StatusOK, - Body: ioutil.NopCloser(bytes.NewBufferString("bar")), + Body: io.NopCloser(bytes.NewBufferString("bar")), Request: req, } require.Len(t, proxy.Fixtures[0].Entries(), 0) @@ -76,7 +75,7 @@ func TestProxy(t *testing.T) { require.Len(t, proxy.Fixtures[0].Entries(), 1) require.Equal(t, "/foo", proxy.Fixtures[0].Entries()[0].Request.URL.Path) require.Equal(t, http.StatusOK, proxy.Fixtures[0].Entries()[0].Response.StatusCode) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) require.NoError(t, err) require.Equal(t, "bar", string(body)) }) @@ -109,7 +108,7 @@ func TestProxy(t *testing.T) { require.Equal(t, "/foo", proxy.Fixtures[0].Entries()[0].Request.URL.Path) require.Equal(t, http.StatusOK, proxy.Fixtures[0].Entries()[0].Response.StatusCode) require.Equal(t, http.StatusOK, res.StatusCode) - resBody, err := ioutil.ReadAll(res.Body) + resBody, err := io.ReadAll(res.Body) require.NoError(t, err) require.Equal(t, "/foo", string(resBody)) }) @@ -122,10 +121,10 @@ func TestProxy(t *testing.T) { req, err := http.NewRequest(http.MethodGet, srv.URL+"/foo", nil) require.NoError(t, err) req.Header = make(http.Header) - req.Body = ioutil.NopCloser(bytes.NewBuffer([]byte("bar"))) + req.Body = io.NopCloser(bytes.NewBuffer([]byte("bar"))) res := &http.Response{ StatusCode: http.StatusOK, - Body: ioutil.NopCloser(bytes.NewBufferString("bar")), + Body: io.NopCloser(bytes.NewBufferString("bar")), Request: req, } err = proxy.Fixtures[0].Add(req, res) @@ -135,7 +134,7 @@ func TestProxy(t *testing.T) { defer resp.Body.Close() require.Equal(t, "/foo", proxy.Fixtures[0].Entries()[0].Request.URL.Path) require.Equal(t, http.StatusOK, proxy.Fixtures[0].Entries()[0].Response.StatusCode) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) require.NoError(t, err) require.Equal(t, "/foo", string(body)) }) @@ -189,7 +188,7 @@ func setupProxy(mode e2e.ProxyMode) (proxy *e2e.Proxy, client *http.Client, serv } func setupFixture() (*http.Request, *http.Response) { - req, err := http.NewRequest("POST", "http://example.com", ioutil.NopCloser(strings.NewReader("test"))) + req, err := http.NewRequest("POST", "http://example.com", io.NopCloser(strings.NewReader("test"))) if err != nil { panic(err) } @@ -197,7 +196,7 @@ func setupFixture() (*http.Request, *http.Response) { res := &http.Response{ StatusCode: http.StatusOK, Header: make(http.Header), - Body: ioutil.NopCloser(strings.NewReader("{\"foo\":\"bar\"}")), + Body: io.NopCloser(strings.NewReader("{\"foo\":\"bar\"}")), } return req, res } @@ -215,13 +214,13 @@ func newFakeStorage() *fakeStorage { } func (s *fakeStorage) Add(req *http.Request, res *http.Response) error { - resBody, err := ioutil.ReadAll(res.Body) + resBody, err := io.ReadAll(res.Body) if err != nil { return err } res.Body = io.NopCloser(bytes.NewBuffer(resBody)) resCopy := *res - resCopy.Body = ioutil.NopCloser(bytes.NewBuffer(resBody)) + resCopy.Body = io.NopCloser(bytes.NewBuffer(resBody)) s.entries = append(s.entries, &storage.Entry{ Request: req, Response: &resCopy, diff --git a/experimental/e2e/storage/har.go b/experimental/e2e/storage/har.go index ce1e3b779..9c8a41d08 100644 --- a/experimental/e2e/storage/har.go +++ b/experimental/e2e/storage/har.go @@ -5,7 +5,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "net/http" "os" "path/filepath" @@ -108,7 +107,7 @@ func (s *HAR) Add(req *http.Request, res *http.Response) error { if err != nil { return err } - res.Body = ioutil.NopCloser(bytes.NewReader(resBody)) + res.Body = io.NopCloser(bytes.NewReader(resBody)) } reqCookies := make([]*har.Cookie, 0) @@ -180,7 +179,7 @@ func (s *HAR) Entries() []*Entry { fmt.Println("Failed to create request", "err", err) continue } - req.Body = ioutil.NopCloser(strings.NewReader(postData)) + req.Body = io.NopCloser(strings.NewReader(postData)) req.ContentLength = e.Request.BodySize req.Header = make(http.Header) for _, header := range e.Request.Headers { @@ -188,13 +187,13 @@ func (s *HAR) Entries() []*Entry { } bodyReq := req.Clone(context.Background()) - bodyReq.Body = ioutil.NopCloser(strings.NewReader(postData)) + bodyReq.Body = io.NopCloser(strings.NewReader(postData)) res := &http.Response{ StatusCode: int(e.Response.Status), Status: e.Response.StatusText, Proto: e.Response.HTTPVersion, Header: make(http.Header), - Body: ioutil.NopCloser(strings.NewReader(e.Response.Content.Text)), + Body: io.NopCloser(strings.NewReader(e.Response.Content.Text)), ContentLength: int64(len(e.Response.Content.Text)), Request: bodyReq, } @@ -245,14 +244,14 @@ func (s *HAR) Save() error { if err != nil { return err } - return ioutil.WriteFile(s.path, raw, 0600) + return os.WriteFile(s.path, raw, 0600) } // Load reads the HAR from disk. func (s *HAR) Load() error { harFiles.rLock(s.path) defer harFiles.rUnlock(s.path) - raw, err := ioutil.ReadFile(s.path) + raw, err := os.ReadFile(s.path) if err != nil { return err } diff --git a/experimental/e2e/storage/har_test.go b/experimental/e2e/storage/har_test.go index 03a5abc2c..84d6088ed 100644 --- a/experimental/e2e/storage/har_test.go +++ b/experimental/e2e/storage/har_test.go @@ -3,7 +3,6 @@ package storage_test import ( "fmt" "io" - "io/ioutil" "net/http" "os" "strings" @@ -136,7 +135,7 @@ func exampleRequest() (*http.Request, *http.Response) { req, _ := http.NewRequest(http.MethodGet, "http://example.com/", nil) res := &http.Response{ StatusCode: http.StatusNotFound, - Body: ioutil.NopCloser(strings.NewReader("")), + Body: io.NopCloser(strings.NewReader("")), } return req, res } diff --git a/experimental/e2e/storage/openapi.go b/experimental/e2e/storage/openapi.go index 98d7fe57c..0c1624cab 100644 --- a/experimental/e2e/storage/openapi.go +++ b/experimental/e2e/storage/openapi.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "strconv" "strings" @@ -87,7 +87,7 @@ func (o *OpenAPI) Match(req *http.Request) *http.Response { ProtoMajor: 1, ProtoMinor: 1, Header: make(http.Header), - Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + Body: io.NopCloser(bytes.NewReader([]byte{})), } res.Request = req @@ -119,7 +119,7 @@ func (o *OpenAPI) Match(req *http.Request) *http.Response { } if body, err := json.Marshal(example); err == nil { - res.Body = ioutil.NopCloser(bytes.NewReader(body)) + res.Body = io.NopCloser(bytes.NewReader(body)) } return res diff --git a/experimental/e2e/storage/openapi_test.go b/experimental/e2e/storage/openapi_test.go index d63c44346..a99a09710 100644 --- a/experimental/e2e/storage/openapi_test.go +++ b/experimental/e2e/storage/openapi_test.go @@ -2,7 +2,7 @@ package storage_test import ( "encoding/json" - "io/ioutil" + "io" "net/http" "testing" @@ -19,7 +19,7 @@ func TestOpenAPIStorage(t *testing.T) { defer res.Body.Close() require.Equal(t, http.StatusOK, res.StatusCode) var respBody map[string]string - b, err := ioutil.ReadAll(res.Body) + b, err := io.ReadAll(res.Body) require.NoError(t, err) err = json.Unmarshal(b, &respBody) require.NoError(t, err) diff --git a/experimental/e2e/utils/http.go b/experimental/e2e/utils/http.go index 4cf83637b..7471053eb 100644 --- a/experimental/e2e/utils/http.go +++ b/experimental/e2e/utils/http.go @@ -4,7 +4,6 @@ import ( "bytes" "crypto/tls" "io" - "io/ioutil" "net/http" "github.com/elazarl/goproxy" @@ -20,7 +19,7 @@ func ReadRequestBody(r *http.Request) ([]byte, error) { if err != nil { return nil, err } - r.Body = ioutil.NopCloser(bytes.NewBuffer(body)) + r.Body = io.NopCloser(bytes.NewBuffer(body)) return body, nil } @@ -34,7 +33,7 @@ func RoundTripper(req *http.Request, ctx *goproxy.ProxyCtx) (resp *http.Response } buf := &bytes.Buffer{} tee := io.TeeReader(req.Body, buf) - req.Body = ioutil.NopCloser(tee) + req.Body = io.NopCloser(tee) _, resp, err = tr.DetailedRoundTrip(req) if resp != nil { resp.Request.Body = io.NopCloser(buf) diff --git a/experimental/fileinfo.go b/experimental/fileinfo.go index 476cbe67e..618e71368 100644 --- a/experimental/fileinfo.go +++ b/experimental/fileinfo.go @@ -1,7 +1,6 @@ package experimental import ( - "io/ioutil" "os" "github.com/grafana/grafana-plugin-sdk-go/data" @@ -14,7 +13,7 @@ func GetDirectoryFrame(p string, details bool) (*data.Frame, error) { // ModTime() time.Time // modification time // IsDir() bool // abbreviation for Mode().IsDir() - files, err := ioutil.ReadDir(p) + files, err := os.ReadDir(p) if err != nil { return nil, err } @@ -42,8 +41,11 @@ func GetDirectoryFrame(p string, details bool) (*data.Frame, error) { mtype.Set(i, mediaType) if details { - size.Set(i, file.Size()) - modified.Set(i, file.ModTime()) + stat, err := os.Stat(file.Name()) + if err == nil { + size.Set(i, stat.Size()) + modified.Set(i, stat.ModTime()) + } } } diff --git a/experimental/http_logger/http_logger.go b/experimental/http_logger/http_logger.go index 64a92e61b..82c7e54e3 100644 --- a/experimental/http_logger/http_logger.go +++ b/experimental/http_logger/http_logger.go @@ -3,7 +3,7 @@ package httplogger import ( "bytes" "fmt" - "io/ioutil" + "io" "net/http" "os" "path" @@ -61,7 +61,7 @@ func (hl *HTTPLogger) RoundTrip(req *http.Request) (*http.Response, error) { buf := []byte{} if req.Body != nil { if b, err := utils.ReadRequestBody(req); err == nil { - req.Body = ioutil.NopCloser(bytes.NewReader(b)) + req.Body = io.NopCloser(bytes.NewReader(b)) buf = b } } @@ -73,7 +73,7 @@ func (hl *HTTPLogger) RoundTrip(req *http.Request) (*http.Response, error) { // reset the request body before saving if req.Body != nil { - req.Body = ioutil.NopCloser(bytes.NewBuffer(buf)) + req.Body = io.NopCloser(bytes.NewBuffer(buf)) } // skip saving if there's an existing entry for this request diff --git a/experimental/http_logger/http_logger_test.go b/experimental/http_logger/http_logger_test.go index 3fa9c8094..e492472a1 100644 --- a/experimental/http_logger/http_logger_test.go +++ b/experimental/http_logger/http_logger_test.go @@ -3,7 +3,7 @@ package httplogger_test import ( "bytes" "errors" - "io/ioutil" + "io" "net/http" "os" "testing" @@ -21,7 +21,7 @@ func TestHTTPLogger(t *testing.T) { require.NoError(t, err) defer res.Body.Close() require.Equal(t, http.StatusOK, res.StatusCode) - b, err := ioutil.ReadAll(res.Body) + b, err := io.ReadAll(res.Body) require.NoError(t, err) require.Equal(t, "OK", string(b)) expected := storage.NewHARStorage("testdata/example.har") @@ -29,7 +29,7 @@ func TestHTTPLogger(t *testing.T) { require.Equal(t, 1, len(actual.Entries())) require.Equal(t, expected.Entries()[0].Request, actual.Entries()[0].Request) require.Equal(t, expected.Entries()[0].Response, actual.Entries()[0].Response) - har, err := ioutil.ReadFile(f.Name()) + har, err := os.ReadFile(f.Name()) require.NoError(t, err) require.Greater(t, len(har), 0) }) @@ -40,7 +40,7 @@ func TestHTTPLogger(t *testing.T) { require.NoError(t, err) defer res.Body.Close() require.Equal(t, http.StatusOK, res.StatusCode) - b, err := ioutil.ReadAll(res.Body) + b, err := io.ReadAll(res.Body) require.NoError(t, err) require.Equal(t, "OK", string(b)) actual := storage.NewHARStorage(f.Name()) @@ -69,7 +69,7 @@ func TestHTTPLogger(t *testing.T) { require.NoError(t, err) defer res.Body.Close() require.Equal(t, http.StatusOK, res.StatusCode) - b, err := ioutil.ReadAll(res.Body) + b, err := io.ReadAll(res.Body) require.NoError(t, err) require.Equal(t, "OK", string(b)) expected := storage.NewHARStorage("testdata/example.har") @@ -77,7 +77,7 @@ func TestHTTPLogger(t *testing.T) { require.Equal(t, 1, len(actual.Entries())) require.Equal(t, expected.Entries()[0].Request, actual.Entries()[0].Request) require.Equal(t, expected.Entries()[0].Response, actual.Entries()[0].Response) - har, err := ioutil.ReadFile(f.Name()) + har, err := os.ReadFile(f.Name()) require.NoError(t, err) require.Greater(t, len(har), 0) }) @@ -110,6 +110,6 @@ type fakeRoundTripper struct{} func (hl *fakeRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusOK, - Body: ioutil.NopCloser(bytes.NewBufferString("OK")), + Body: io.NopCloser(bytes.NewBufferString("OK")), }, nil } diff --git a/experimental/rest_client.go b/experimental/rest_client.go index 498c5af75..58c006196 100644 --- a/experimental/rest_client.go +++ b/experimental/rest_client.go @@ -4,7 +4,7 @@ import ( "context" "crypto/tls" "errors" - "io/ioutil" + "io" "net" "net/http" "net/url" @@ -66,7 +66,7 @@ func (c *restClient) Fetch(ctx context.Context, path string, params string) ([]b if resp.StatusCode != 200 { return nil, errors.New(resp.Status) } - responseData, err := ioutil.ReadAll(resp.Body) + responseData, err := io.ReadAll(resp.Body) if err != nil { return nil, err } diff --git a/experimental/sdata/numeric/multi.go b/experimental/sdata/numeric/multi.go index a2924d89a..78435aebf 100644 --- a/experimental/sdata/numeric/multi.go +++ b/experimental/sdata/numeric/multi.go @@ -53,19 +53,19 @@ func (mf *MultiFrame) SetMetricMD(metricName string, l data.Labels, fc data.Fiel /* Rules: -- Whenever an error is returned, there are no ignored fields returned -- Must have at least one frame -- The first frame must be valid or will error, additional invalid frames with the type indicator will error, + - Whenever an error is returned, there are no ignored fields returned + - Must have at least one frame + - The first frame must be valid or will error, additional invalid frames with the type indicator will error, frames without type indicator are ignored -- A valid individual Frame (in the non empty case) has a numeric field and a type indicator -- Any nil Frames or Fields will cause an error (e.g. [Frame, Frame, nil, Frame] or [nil]) -- If any frame has fields within the frame of different lengths, an error will be returned -- If validateData is true, duplicate metricName+Labels will error -- If all frames and their fields are ignored, and it is not the empty response case, an error is returned + - A valid individual Frame (in the non empty case) has a numeric field and a type indicator + - Any nil Frames or Fields will cause an error (e.g. [Frame, Frame, nil, Frame] or [nil]) + - If any frame has fields within the frame of different lengths, an error will be returned + - If validateData is true, duplicate metricName+Labels will error + - If all frames and their fields are ignored, and it is not the empty response case, an error is returned Things to decide: - - Seems like allowing (ignoring) more than 1 row is not a good idea (outside of Long) - - Will allow for extra frames + - Seems like allowing (ignoring) more than 1 row is not a good idea (outside of Long) + - Will allow for extra frames TODO: Change this to follow the above */ diff --git a/go.mod b/go.mod index 60809e691..1a0981b61 100644 --- a/go.mod +++ b/go.mod @@ -1,26 +1,26 @@ module github.com/grafana/grafana-plugin-sdk-go -go 1.17 +go 1.19 require ( github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 github.com/cheekybits/genny v1.0.0 github.com/golang/protobuf v1.5.2 // indirect - github.com/google/go-cmp v0.5.7 + github.com/google/go-cmp v0.5.9 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/hashicorp/go-hclog v0.14.1 github.com/hashicorp/go-plugin v1.4.3 github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect github.com/json-iterator/go v1.1.12 - github.com/magefile/mage v1.13.0 + github.com/magefile/mage v1.14.0 github.com/mattetti/filebuffer v1.0.1 github.com/mitchellh/go-testing-interface v1.0.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 github.com/olekukonko/tablewriter v0.0.5 github.com/prometheus/client_golang v1.12.1 github.com/prometheus/common v0.32.1 - github.com/stretchr/testify v1.7.2 + github.com/stretchr/testify v1.8.1 golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 google.golang.org/grpc v1.41.0 google.golang.org/protobuf v1.27.1 @@ -33,6 +33,8 @@ require ( github.com/getkin/kin-openapi v0.94.0 github.com/google/uuid v1.3.0 github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 + github.com/urfave/cli v1.22.1 + golang.org/x/text v0.3.6 ) require ( @@ -67,9 +69,7 @@ require ( github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/unknwon/com v1.0.1 // indirect github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 // indirect - github.com/urfave/cli v1.22.1 // indirect golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect - golang.org/x/text v0.3.6 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 // indirect gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect diff --git a/go.sum b/go.sum index a36537827..ecb4198da 100644 --- a/go.sum +++ b/go.sum @@ -162,8 +162,8 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -229,8 +229,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/magefile/mage v1.13.0 h1:XtLJl8bcCM7EFoO8FyH8XK3t7G5hQAeK+i4tq+veT9M= -github.com/magefile/mage v1.13.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= +github.com/magefile/mage v1.14.0 h1:6QDX3g6z1YvJ4olPhT1wksUcSa/V0a1B+pJb73fBjyo= +github.com/magefile/mage v1.14.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= @@ -316,14 +316,18 @@ github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c h1:Ho+uVpke github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 h1:aVGB3YnaS/JNfOW3tiHIlmNmTDg618va+eT0mVomgyI= github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8/go.mod h1:fVle4kNr08ydeohzYafr20oZzbAkhQT39gKK/pFQ5M4= github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs=