From 27c9055b1042635939b6e62356050ab85cfb2ddc Mon Sep 17 00:00:00 2001 From: Adrien Aury Date: Fri, 31 Mar 2023 11:47:32 +0000 Subject: [PATCH 1/4] chore: go 1.20 --- .devcontainer/Dockerfile | 2 +- .devcontainer/Dockerfile.ci | 2 +- go.mod | 22 +++++++++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b1a9e7d..78bd0ea 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM adrienaury/go-devcontainer:v0.5 +FROM adrienaury/go-devcontainer:v2.0 USER root diff --git a/.devcontainer/Dockerfile.ci b/.devcontainer/Dockerfile.ci index 47f914d..3b9e6b1 100644 --- a/.devcontainer/Dockerfile.ci +++ b/.devcontainer/Dockerfile.ci @@ -1,4 +1,4 @@ -FROM adrienaury/go-devcontainer-ci:v0.5 +FROM adrienaury/go-devcontainer-ci:v2.0 USER root diff --git a/go.mod b/go.mod index 5627a68..c3a5c59 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/cgi-fr/jsonline -go 1.16 +go 1.20 require ( github.com/Trendyol/overlog v0.1.0 @@ -11,3 +11,23 @@ require ( github.com/stretchr/testify v1.7.0 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b ) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/magiconair/properties v1.8.5 // indirect + github.com/mitchellh/mapstructure v1.4.2 // indirect + github.com/pelletier/go-toml v1.9.4 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect + golang.org/x/text v0.3.6 // indirect + gopkg.in/ini.v1 v1.63.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect +) From 6f5423b517e604c0b3431e8c1a56a47a43ae7444 Mon Sep 17 00:00:00 2001 From: Adrien Aury Date: Fri, 31 Mar 2023 11:49:17 +0000 Subject: [PATCH 2/4] feat: implement Keyed interface --- pkg/jsonline/row.go | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/pkg/jsonline/row.go b/pkg/jsonline/row.go index 5305e05..74c18d1 100644 --- a/pkg/jsonline/row.go +++ b/pkg/jsonline/row.go @@ -32,6 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. +//nolint:nolintlint package jsonline import ( @@ -555,7 +556,7 @@ func (r *row) DebugString() string { return strings.ReplaceAll(sb.String(), `"`, "`") } -//nolint +// nolint func (r *row) UnmarshalJSON(data []byte) error { dec := json.NewDecoder(bytes.NewReader(data)) dec.UseNumber() @@ -582,7 +583,7 @@ func (r *row) UnmarshalJSON(data []byte) error { return nil } -//nolint +// nolint func (r *row) parseobject(dec *json.Decoder) (err error) { var t json.Token for dec.More() { @@ -630,7 +631,7 @@ func (r *row) parseobject(dec *json.Decoder) (err error) { return nil } -//nolint +// nolint func parsearray(dec *json.Decoder) (arr []interface{}, err error) { var t json.Token arr = make([]interface{}, 0) @@ -659,7 +660,7 @@ func parsearray(dec *json.Decoder) (arr []interface{}, err error) { return } -//nolint +// nolint func handledelim(t json.Token, dec *json.Decoder) (res interface{}, err error) { if delim, ok := t.(json.Delim); ok { switch delim { @@ -779,3 +780,33 @@ func (r *row) GetTime(key string) time.Time { return result.(time.Time) } + +// ValueForKey should return the value associated with the key or nil if +// no entry exists for the key. +func (r *row) ValueForKey(key string) (value any, has bool) { + value, has = r.Get(key) + return +} + +// SetValueForKey sets the value for a key in the collection. +func (r *row) SetValueForKey(key string, value any) { + r.Set(key, value) +} + +// RemoveValueForKey removes the value for a key in the collection. +func (r *row) RemoveValueForKey(key string) { + panic("unimplemented") +} + +// Keys should return an list of the keys for all the entries in the +// collection. +func (r *row) Keys() []string { + keys := []string{} + iter := r.Iter() + + for k, _, ok := iter(); ok; k, _, ok = iter() { + keys = append(keys, k) + } + + return keys +} From fb5984bd4dd66c7e3385141be680a1b6821bb8a9 Mon Sep 17 00:00:00 2001 From: Adrien Aury Date: Fri, 31 Mar 2023 12:21:45 +0000 Subject: [PATCH 3/4] chore: fix build error --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 7a58e17..97fe8cc 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ init: @chmod 0600 ~/.dockerhub.yml @touch ~/.github.yml @chmod 0600 ~/.github.yml + @git config --global --add safe.directory /workspace @git config --local core.hooksPath githooks .PHONY: warning From b5b586d3bf87290491db5501dd6abe1051683fa7 Mon Sep 17 00:00:00 2001 From: Adrien Aury Date: Fri, 31 Mar 2023 13:26:53 +0000 Subject: [PATCH 4/4] style: lint fix --- cmd/jl/definition.go | 7 ++++--- cmd/jl/main.go | 3 ++- cmd/jl/root.go | 7 ++++--- pkg/cast/binary.go | 2 +- pkg/cast/bool.go | 2 +- pkg/cast/cast_test.go | 1 + pkg/cast/float.go | 2 +- pkg/cast/int.go | 2 +- pkg/cast/number.go | 2 +- pkg/cast/string.go | 2 +- pkg/cast/time.go | 2 +- pkg/cast/uint.go | 2 +- pkg/jsonline/conversions_export.go | 19 +++++++++--------- pkg/jsonline/conversions_import.go | 31 +++++++++++++++--------------- pkg/jsonline/exporter.go | 1 + pkg/jsonline/importer.go | 1 + pkg/jsonline/row.go | 3 ++- pkg/jsonline/row_test.go | 1 + pkg/jsonline/streamer.go | 1 + pkg/jsonline/template.go | 1 + pkg/jsonline/template_test.go | 1 + pkg/jsonline/usecase_test.go | 1 + pkg/jsonline/value.go | 1 + pkg/jsonline/value_test.go | 2 +- 24 files changed, 56 insertions(+), 41 deletions(-) diff --git a/cmd/jl/definition.go b/cmd/jl/definition.go index a9cc016..04492f7 100644 --- a/cmd/jl/definition.go +++ b/cmd/jl/definition.go @@ -15,12 +15,12 @@ // You should have received a copy of the GNU General Public License // along with JL. If not, see . +//nolint:ireturn,varnamelen package main import ( "encoding/json" "fmt" - "io/ioutil" "os" "regexp" "strings" @@ -60,7 +60,7 @@ func ReadRowDefinition(filename string) (*RowDefinition, error) { } if _, err := os.Stat(filename); err == nil { - dat, err := ioutil.ReadFile(filename) + dat, err := os.ReadFile(filename) if err != nil { return nil, fmt.Errorf("%w", err) } @@ -112,7 +112,8 @@ func parseDescriptor(def string) (jsonline.Format, jsonline.RawType) { } func parse(ti jsonline.Template, to jsonline.Template, - columns []ColumnDefinition) (jsonline.Template, jsonline.Template, error) { + columns []ColumnDefinition, +) (jsonline.Template, jsonline.Template, error) { for _, column := range columns { iformat, irawtype := parseDescriptor(column.Input) oformat, orawtype := parseDescriptor(column.Output) diff --git a/cmd/jl/main.go b/cmd/jl/main.go index 618a48f..1c92e98 100644 --- a/cmd/jl/main.go +++ b/cmd/jl/main.go @@ -25,6 +25,7 @@ import ( ) // Provisioned by ldflags +// //nolint:gochecknoglobals var ( name string @@ -35,7 +36,7 @@ var ( ) func main() { - log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) //nolint:exhaustivestruct + log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) //nolint:exhaustruct,exhaustivestruct cmd, err := NewRootCommand() if err != nil { diff --git a/cmd/jl/root.go b/cmd/jl/root.go index d04ca61..04b4df5 100644 --- a/cmd/jl/root.go +++ b/cmd/jl/root.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with JL. If not, see . +//nolint:varnamelen,ireturn package main import ( @@ -52,7 +53,7 @@ type RootCommand struct { } func NewRootCommand() (*RootCommand, error) { - rootCmd := cobra.Command{ //nolint:exhaustivestruct + rootCmd := cobra.Command{ //nolint:exhaustruct,exhaustivestruct Use: fmt.Sprintf("%v", name), Short: "JSONLine templating", Long: `Order keys and enforce format of JSON lines.`, @@ -139,7 +140,7 @@ func initConfig() { if jsonlog { log.Logger = zerolog.New(os.Stderr) } else { - log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, NoColor: !color}) //nolint:exhaustivestruct + log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, NoColor: !color}) //nolint:exhaustruct,exhaustivestruct } debug := viper.GetBool("debug") @@ -193,7 +194,7 @@ func initViper() { viper.AddConfigPath("$HOME/.jl") if err := viper.ReadInConfig(); err != nil { - // nolint: errorlint + //nolint:errorlint if _, ok := err.(viper.ConfigFileNotFoundError); ok { // Config file not found; ignore } else { diff --git a/pkg/cast/binary.go b/pkg/cast/binary.go index 0d72860..95651d7 100644 --- a/pkg/cast/binary.go +++ b/pkg/cast/binary.go @@ -32,7 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. -//nolint:cyclop,funlen +//nolint:cyclop,funlen,varnamelen package cast import ( diff --git a/pkg/cast/bool.go b/pkg/cast/bool.go index a535145..611a592 100644 --- a/pkg/cast/bool.go +++ b/pkg/cast/bool.go @@ -32,7 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. -//nolint:cyclop,funlen +//nolint:cyclop,funlen,varnamelen package cast import ( diff --git a/pkg/cast/cast_test.go b/pkg/cast/cast_test.go index 37d6c51..2ea5fb6 100644 --- a/pkg/cast/cast_test.go +++ b/pkg/cast/cast_test.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with the jsonline library. If not, see . +//nolint:varnamelen package cast_test import ( diff --git a/pkg/cast/float.go b/pkg/cast/float.go index ab9eb27..bb1048d 100644 --- a/pkg/cast/float.go +++ b/pkg/cast/float.go @@ -32,7 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. -//nolint:cyclop,funlen,gomnd +//nolint:cyclop,funlen,nilnil,varnamelen package cast import ( diff --git a/pkg/cast/int.go b/pkg/cast/int.go index 773eed0..7b069f3 100644 --- a/pkg/cast/int.go +++ b/pkg/cast/int.go @@ -32,7 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. -//nolint:cyclop,gocyclo,gocognit,funlen,gomnd +//nolint:cyclop,gocyclo,gocognit,funlen,nilnil,varnamelen package cast import ( diff --git a/pkg/cast/number.go b/pkg/cast/number.go index 1d701f7..ac331b6 100644 --- a/pkg/cast/number.go +++ b/pkg/cast/number.go @@ -32,7 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. -//nolint:cyclop,gomnd +//nolint:cyclop,varnamelen package cast import ( diff --git a/pkg/cast/string.go b/pkg/cast/string.go index 430899d..2a9a1d6 100644 --- a/pkg/cast/string.go +++ b/pkg/cast/string.go @@ -32,7 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. -//nolint:cyclop,gomnd +//nolint:cyclop,varnamelen package cast import ( diff --git a/pkg/cast/time.go b/pkg/cast/time.go index 240bd41..e6242fb 100644 --- a/pkg/cast/time.go +++ b/pkg/cast/time.go @@ -32,7 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. -//nolint:cyclop +//nolint:cyclop,varnamelen package cast import ( diff --git a/pkg/cast/uint.go b/pkg/cast/uint.go index f573817..0433f0e 100644 --- a/pkg/cast/uint.go +++ b/pkg/cast/uint.go @@ -32,7 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. -//nolint:cyclop,gocyclo,gocognit,funlen,gomnd +//nolint:cyclop,gocyclo,gocognit,funlen,varnamelen,nilnil package cast import ( diff --git a/pkg/jsonline/conversions_export.go b/pkg/jsonline/conversions_export.go index 046f47e..1a709ed 100644 --- a/pkg/jsonline/conversions_export.go +++ b/pkg/jsonline/conversions_export.go @@ -32,6 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. +//nolint:forcetypeassert package jsonline import ( @@ -44,7 +45,7 @@ import ( func exportToString(val interface{}) (interface{}, error) { str, err := cast.ToString(val) if err != nil { - return nil, fmt.Errorf("%w %T to String format: %v", ErrUnsupportedExportType, val, err) + return nil, fmt.Errorf("%w %T to String format: %w", ErrUnsupportedExportType, val, err) } return str, nil @@ -53,7 +54,7 @@ func exportToString(val interface{}) (interface{}, error) { func exportToNumber(val interface{}) (interface{}, error) { nb, err := cast.ToNumber(val) if err != nil { - return nil, fmt.Errorf("%w %T to Number format: %v", ErrUnsupportedExportType, val, err) + return nil, fmt.Errorf("%w %T to Number format: %w", ErrUnsupportedExportType, val, err) } return nb, nil @@ -62,7 +63,7 @@ func exportToNumber(val interface{}) (interface{}, error) { func exportToBool(val interface{}) (interface{}, error) { b, err := cast.ToBool(val) if err != nil { - return nil, fmt.Errorf("%w %T to Boolean format: %v", ErrUnsupportedExportType, val, err) + return nil, fmt.Errorf("%w %T to Boolean format: %w", ErrUnsupportedExportType, val, err) } return b, nil @@ -71,7 +72,7 @@ func exportToBool(val interface{}) (interface{}, error) { func exportToBinary(val interface{}) (interface{}, error) { b, err := cast.ToBinary(val) if err != nil { - return nil, fmt.Errorf("%w %T to Binary format: %v", ErrUnsupportedExportType, val, err) + return nil, fmt.Errorf("%w %T to Binary format: %w", ErrUnsupportedExportType, val, err) } return base64.StdEncoding.EncodeToString(b.([]byte)), nil @@ -80,12 +81,12 @@ func exportToBinary(val interface{}) (interface{}, error) { func exportToDate(val interface{}) (interface{}, error) { t, err := cast.ToDate(val) if err != nil { - return nil, fmt.Errorf("%w %T to Date format: %v", ErrUnsupportedExportType, val, err) + return nil, fmt.Errorf("%w %T to Date format: %w", ErrUnsupportedExportType, val, err) } str, err := cast.ToString(t) if err != nil { - return nil, fmt.Errorf("%w %T to Date format: %v", ErrUnsupportedExportType, val, err) + return nil, fmt.Errorf("%w %T to Date format: %w", ErrUnsupportedExportType, val, err) } return str, nil @@ -94,12 +95,12 @@ func exportToDate(val interface{}) (interface{}, error) { func exportToDateTime(val interface{}) (interface{}, error) { t, err := cast.ToTime(val) if err != nil { - return nil, fmt.Errorf("%w %T to DateTime format: %v", ErrUnsupportedExportType, val, err) + return nil, fmt.Errorf("%w %T to DateTime format: %w", ErrUnsupportedExportType, val, err) } str, err := cast.ToString(t) if err != nil { - return nil, fmt.Errorf("%w %T to DateTime format: %v", ErrUnsupportedExportType, val, err) + return nil, fmt.Errorf("%w %T to DateTime format: %w", ErrUnsupportedExportType, val, err) } return str, nil @@ -108,7 +109,7 @@ func exportToDateTime(val interface{}) (interface{}, error) { func exportToTimestamp(val interface{}) (interface{}, error) { i64, err := cast.ToTimestamp(val) if err != nil { - return nil, fmt.Errorf("%w %T to Timestamp format: %v", ErrUnsupportedExportType, val, err) + return nil, fmt.Errorf("%w %T to Timestamp format: %w", ErrUnsupportedExportType, val, err) } return i64, nil diff --git a/pkg/jsonline/conversions_import.go b/pkg/jsonline/conversions_import.go index 6ed6951..4891a11 100644 --- a/pkg/jsonline/conversions_import.go +++ b/pkg/jsonline/conversions_import.go @@ -32,6 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. +//nolint:varnamelen package jsonline import ( @@ -46,7 +47,7 @@ func importFromString(val interface{}, targetType RawType) (interface{}, error) case nil: str, err := cast.ToString(val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return str, nil @@ -54,7 +55,7 @@ func importFromString(val interface{}, targetType RawType) (interface{}, error) default: i, err := cast.To(targetType, val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return i, nil @@ -66,7 +67,7 @@ func importFromNumeric(val interface{}, targetType RawType) (interface{}, error) case nil: nb, err := cast.ToNumber(val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return nb, nil @@ -74,7 +75,7 @@ func importFromNumeric(val interface{}, targetType RawType) (interface{}, error) default: i, err := cast.To(targetType, val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return i, nil @@ -86,7 +87,7 @@ func importFromBoolean(val interface{}, targetType RawType) (interface{}, error) case nil: b, err := cast.ToBool(val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return b, nil @@ -94,7 +95,7 @@ func importFromBoolean(val interface{}, targetType RawType) (interface{}, error) default: i, err := cast.To(targetType, val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return i, nil @@ -104,12 +105,12 @@ func importFromBoolean(val interface{}, targetType RawType) (interface{}, error) func importFromBinary(val interface{}, targetType RawType) (interface{}, error) { str, err := cast.ToString(val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } b, err := base64.StdEncoding.DecodeString(str.(string)) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } switch targetType.(type) { @@ -119,7 +120,7 @@ func importFromBinary(val interface{}, targetType RawType) (interface{}, error) default: i, err := cast.To(targetType, b) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, b, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, b, targetType, err) } return i, nil @@ -131,7 +132,7 @@ func importFromDate(val interface{}, targetType RawType) (interface{}, error) { case nil: t, err := cast.ToDate(val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return t, nil @@ -139,7 +140,7 @@ func importFromDate(val interface{}, targetType RawType) (interface{}, error) { default: i, err := cast.To(targetType, val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return i, nil @@ -151,7 +152,7 @@ func importFromDateTime(val interface{}, targetType RawType) (interface{}, error case nil: t, err := cast.ToTime(val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return t, nil @@ -159,7 +160,7 @@ func importFromDateTime(val interface{}, targetType RawType) (interface{}, error default: i, err := cast.To(targetType, val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return i, nil @@ -171,7 +172,7 @@ func importFromTimestamp(val interface{}, targetType RawType) (interface{}, erro case nil: i64, err := cast.ToInt64(val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return i64, nil @@ -179,7 +180,7 @@ func importFromTimestamp(val interface{}, targetType RawType) (interface{}, erro default: i, err := cast.To(targetType, val) if err != nil { - return nil, fmt.Errorf("%w %T to %T format: %v", ErrUnsupportedImportType, val, targetType, err) + return nil, fmt.Errorf("%w %T to %T format: %w", ErrUnsupportedImportType, val, targetType, err) } return i, nil diff --git a/pkg/jsonline/exporter.go b/pkg/jsonline/exporter.go index 392c6ae..b3fb48d 100644 --- a/pkg/jsonline/exporter.go +++ b/pkg/jsonline/exporter.go @@ -32,6 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. +//nolint:ireturn,varnamelen package jsonline import ( diff --git a/pkg/jsonline/importer.go b/pkg/jsonline/importer.go index e710dc2..4754c1e 100644 --- a/pkg/jsonline/importer.go +++ b/pkg/jsonline/importer.go @@ -32,6 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. +//nolint:ireturn,varnamelen,nilnil package jsonline import ( diff --git a/pkg/jsonline/row.go b/pkg/jsonline/row.go index 74c18d1..076d21e 100644 --- a/pkg/jsonline/row.go +++ b/pkg/jsonline/row.go @@ -32,7 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. -//nolint:nolintlint +//nolint:nolintlint,interfacebloat,ireturn,varnamelen,nonamedreturns,forcetypeassert package jsonline import ( @@ -785,6 +785,7 @@ func (r *row) GetTime(key string) time.Time { // no entry exists for the key. func (r *row) ValueForKey(key string) (value any, has bool) { value, has = r.Get(key) + return } diff --git a/pkg/jsonline/row_test.go b/pkg/jsonline/row_test.go index 8e59028..373bd31 100644 --- a/pkg/jsonline/row_test.go +++ b/pkg/jsonline/row_test.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with the jsonline library. If not, see . +//nolint:varnamelen package jsonline_test import ( diff --git a/pkg/jsonline/streamer.go b/pkg/jsonline/streamer.go index d16fd49..05f18e2 100644 --- a/pkg/jsonline/streamer.go +++ b/pkg/jsonline/streamer.go @@ -32,6 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. +//nolint:ireturn package jsonline import ( diff --git a/pkg/jsonline/template.go b/pkg/jsonline/template.go index 711e06e..795a1be 100644 --- a/pkg/jsonline/template.go +++ b/pkg/jsonline/template.go @@ -32,6 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. +//nolint:interfacebloat,ireturn,varnamelen package jsonline import ( diff --git a/pkg/jsonline/template_test.go b/pkg/jsonline/template_test.go index 2882015..1aace90 100644 --- a/pkg/jsonline/template_test.go +++ b/pkg/jsonline/template_test.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with the jsonline library. If not, see . +//nolint:varnamelen package jsonline_test import ( diff --git a/pkg/jsonline/usecase_test.go b/pkg/jsonline/usecase_test.go index 193531c..b636db3 100644 --- a/pkg/jsonline/usecase_test.go +++ b/pkg/jsonline/usecase_test.go @@ -1,3 +1,4 @@ +//nolint:varnamelen package jsonline_test import ( diff --git a/pkg/jsonline/value.go b/pkg/jsonline/value.go index a9157f0..978cecd 100644 --- a/pkg/jsonline/value.go +++ b/pkg/jsonline/value.go @@ -32,6 +32,7 @@ // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. +//nolint:ireturn,varnamelen,nilnil package jsonline import ( diff --git a/pkg/jsonline/value_test.go b/pkg/jsonline/value_test.go index 10621c3..2fc27d6 100644 --- a/pkg/jsonline/value_test.go +++ b/pkg/jsonline/value_test.go @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with the jsonline library. If not, see . -//nolint:dupl +//nolint:dupl,varnamelen package jsonline_test import (