diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2023-03-19 20:32:12 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-19 20:32:12 -0500 |
| commit | fdba91ea77755752e88fda095dda6740a6a1d764 (patch) | |
| tree | ef090e783ace329dac9df1d92ed237469a466e9d | |
| parent | e89af5debb3a5d15a571d501bdd12b1fd8861cea (diff) | |
| parent | e34b2a5d28970f0fd3ae677180a1e33488245a4c (diff) | |
Merge pull request #1684 from hairyhenderson/fix-lint
fix new lint errors
| -rw-r--r-- | aws/kms.go | 2 | ||||
| -rw-r--r-- | aws/sts.go | 2 | ||||
| -rw-r--r-- | context.go | 2 | ||||
| -rw-r--r-- | data/data_test.go | 4 | ||||
| -rw-r--r-- | data/datasource_aws_sm_test.go | 2 | ||||
| -rw-r--r-- | data/datasource_awssmp_test.go | 4 | ||||
| -rw-r--r-- | data/datasource_consul.go | 2 | ||||
| -rw-r--r-- | data/datasource_env.go | 2 | ||||
| -rw-r--r-- | data/datasource_file.go | 2 | ||||
| -rw-r--r-- | data/datasource_merge.go | 2 | ||||
| -rw-r--r-- | data/datasource_stdin.go | 2 | ||||
| -rw-r--r-- | data/datasource_test.go | 2 | ||||
| -rw-r--r-- | data/datasource_vault.go | 2 | ||||
| -rw-r--r-- | env/env_test.go | 4 | ||||
| -rw-r--r-- | internal/cmd/config.go | 2 | ||||
| -rw-r--r-- | internal/tests/integration/test_ec2_utils.go | 6 | ||||
| -rw-r--r-- | internal/texttemplate/funcs.go | 8 | ||||
| -rw-r--r-- | libkv/libkv_test.go | 20 | ||||
| -rw-r--r-- | template.go | 2 |
19 files changed, 36 insertions, 36 deletions
@@ -18,7 +18,7 @@ type KMS struct { } // NewKMS - Create new AWS KMS client using an SDKSession -func NewKMS(option ClientOptions) *KMS { +func NewKMS(_ ClientOptions) *KMS { client := kms.New(SDKSession()) return &KMS{ Client: client, @@ -19,7 +19,7 @@ type CallerIdentitifier interface { } // NewSTS - -func NewSTS(options ClientOptions) *STS { +func NewSTS(_ ClientOptions) *STS { return &STS{ identifier: func() CallerIdentitifier { if identifierClient == nil { @@ -22,7 +22,7 @@ func (c *tmplctx) Env() map[string]string { } // createTmplContext reads the datasources for the given aliases -func createTmplContext(ctx context.Context, aliases []string, +func createTmplContext(_ context.Context, aliases []string, //nolint:staticcheck d *data.Data) (interface{}, error) { var err error diff --git a/data/data_test.go b/data/data_test.go index 2dae989c..2d847a99 100644 --- a/data/data_test.go +++ b/data/data_test.go @@ -169,11 +169,11 @@ func TestToJSONBytes(t *testing.T) { type badObject struct { } -func (b *badObject) CodecEncodeSelf(e *codec.Encoder) { +func (b *badObject) CodecEncodeSelf(_ *codec.Encoder) { panic("boom") } -func (b *badObject) CodecDecodeSelf(e *codec.Decoder) { +func (b *badObject) CodecDecodeSelf(_ *codec.Decoder) { } diff --git a/data/datasource_aws_sm_test.go b/data/datasource_aws_sm_test.go index c274dcf8..f4e28a4e 100644 --- a/data/datasource_aws_sm_test.go +++ b/data/datasource_aws_sm_test.go @@ -20,7 +20,7 @@ type DummyAWSSecretsManagerSecretGetter struct { mockGetSecretValue func(input *secretsmanager.GetSecretValueInput) (*secretsmanager.GetSecretValueOutput, error) } -func (d DummyAWSSecretsManagerSecretGetter) GetSecretValueWithContext(ctx context.Context, input *secretsmanager.GetSecretValueInput, opts ...request.Option) (*secretsmanager.GetSecretValueOutput, error) { +func (d DummyAWSSecretsManagerSecretGetter) GetSecretValueWithContext(_ context.Context, input *secretsmanager.GetSecretValueInput, _ ...request.Option) (*secretsmanager.GetSecretValueOutput, error) { if d.mockGetSecretValue != nil { output, err := d.mockGetSecretValue(input) return output, err diff --git a/data/datasource_awssmp_test.go b/data/datasource_awssmp_test.go index 7fac1084..06d3e035 100644 --- a/data/datasource_awssmp_test.go +++ b/data/datasource_awssmp_test.go @@ -22,7 +22,7 @@ type DummyParamGetter struct { params []*ssm.Parameter } -func (d DummyParamGetter) GetParameterWithContext(ctx context.Context, input *ssm.GetParameterInput, opts ...request.Option) (*ssm.GetParameterOutput, error) { +func (d DummyParamGetter) GetParameterWithContext(_ context.Context, input *ssm.GetParameterInput, _ ...request.Option) (*ssm.GetParameterOutput, error) { if d.mockGetParameter != nil { output, err := d.mockGetParameter(input) return output, err @@ -36,7 +36,7 @@ func (d DummyParamGetter) GetParameterWithContext(ctx context.Context, input *ss }, nil } -func (d DummyParamGetter) GetParametersByPathWithContext(ctx context.Context, input *ssm.GetParametersByPathInput, opts ...request.Option) (*ssm.GetParametersByPathOutput, error) { +func (d DummyParamGetter) GetParametersByPathWithContext(_ context.Context, _ *ssm.GetParametersByPathInput, _ ...request.Option) (*ssm.GetParametersByPathOutput, error) { if d.err != nil { return nil, d.err } diff --git a/data/datasource_consul.go b/data/datasource_consul.go index 8c134ed6..ecc7e516 100644 --- a/data/datasource_consul.go +++ b/data/datasource_consul.go @@ -7,7 +7,7 @@ import ( "github.com/hairyhenderson/gomplate/v4/libkv" ) -func readConsul(ctx context.Context, source *Source, args ...string) (data []byte, err error) { +func readConsul(_ context.Context, source *Source, args ...string) (data []byte, err error) { if source.kv == nil { source.kv, err = libkv.NewConsul(source.URL) if err != nil { diff --git a/data/datasource_env.go b/data/datasource_env.go index 06445b21..70780f5c 100644 --- a/data/datasource_env.go +++ b/data/datasource_env.go @@ -7,7 +7,7 @@ import ( "github.com/hairyhenderson/gomplate/v4/env" ) -func readEnv(ctx context.Context, source *Source, args ...string) (b []byte, err error) { +func readEnv(_ context.Context, source *Source, _ ...string) (b []byte, err error) { n := source.URL.Path n = strings.TrimPrefix(n, "/") if n == "" { diff --git a/data/datasource_file.go b/data/datasource_file.go index 870c93f4..156ab276 100644 --- a/data/datasource_file.go +++ b/data/datasource_file.go @@ -14,7 +14,7 @@ import ( "github.com/spf13/afero" ) -func readFile(ctx context.Context, source *Source, args ...string) ([]byte, error) { +func readFile(_ context.Context, source *Source, args ...string) ([]byte, error) { if source.fs == nil { source.fs = afero.NewOsFs() } diff --git a/data/datasource_merge.go b/data/datasource_merge.go index 7bfd53ed..f2c28399 100644 --- a/data/datasource_merge.go +++ b/data/datasource_merge.go @@ -19,7 +19,7 @@ import ( // the source data. To merge datasources with query strings or fragments, define // separate sources first and specify the alias names. HTTP headers are also not // supported directly. -func (d *Data) readMerge(ctx context.Context, source *Source, args ...string) ([]byte, error) { +func (d *Data) readMerge(ctx context.Context, source *Source, _ ...string) ([]byte, error) { opaque := source.URL.Opaque parts := strings.Split(opaque, "|") if len(parts) < 2 { diff --git a/data/datasource_stdin.go b/data/datasource_stdin.go index 98fbefb3..13bb5fa4 100644 --- a/data/datasource_stdin.go +++ b/data/datasource_stdin.go @@ -7,7 +7,7 @@ import ( "os" ) -func readStdin(ctx context.Context, source *Source, args ...string) ([]byte, error) { +func readStdin(ctx context.Context, _ *Source, _ ...string) ([]byte, error) { stdin := stdinFromContext(ctx) b, err := io.ReadAll(stdin) diff --git a/data/datasource_test.go b/data/datasource_test.go index 33a9dedd..5455699e 100644 --- a/data/datasource_test.go +++ b/data/datasource_test.go @@ -180,7 +180,7 @@ func TestInclude(t *testing.T) { type errorReader struct{} -func (e errorReader) Read(p []byte) (n int, err error) { +func (e errorReader) Read(_ []byte) (n int, err error) { return 0, fmt.Errorf("error") } diff --git a/data/datasource_vault.go b/data/datasource_vault.go index a96d7e90..5f736dcb 100644 --- a/data/datasource_vault.go +++ b/data/datasource_vault.go @@ -8,7 +8,7 @@ import ( "github.com/hairyhenderson/gomplate/v4/vault" ) -func readVault(ctx context.Context, source *Source, args ...string) (data []byte, err error) { +func readVault(_ context.Context, source *Source, args ...string) (data []byte, err error) { if source.vc == nil { source.vc, err = vault.New(source.URL) if err != nil { diff --git a/env/env_test.go b/env/env_test.go index 122c2380..59bf4048 100644 --- a/env/env_test.go +++ b/env/env_test.go @@ -92,11 +92,11 @@ func (fs woFS) OpenFile(name string, flag int, perm os.FileMode) (afero.File, er return writeOnlyFile(f), nil } -func (fs woFS) ReadDir(path string) ([]os.FileInfo, error) { +func (fs woFS) ReadDir(_ string) ([]os.FileInfo, error) { return nil, ErrWriteOnly } -func (fs woFS) Stat(name string) (os.FileInfo, error) { +func (fs woFS) Stat(_ string) (os.FileInfo, error) { return nil, ErrWriteOnly } diff --git a/internal/cmd/config.go b/internal/cmd/config.go index 9921584c..cfba90f7 100644 --- a/internal/cmd/config.go +++ b/internal/cmd/config.go @@ -235,7 +235,7 @@ func processIncludes(includes, excludes []string) []string { return out } -func applyEnvVars(ctx context.Context, cfg *config.Config) (*config.Config, error) { +func applyEnvVars(_ context.Context, cfg *config.Config) (*config.Config, error) { if to := env.Getenv("GOMPLATE_PLUGIN_TIMEOUT"); cfg.PluginTimeout == 0 && to != "" { t, err := time.ParseDuration(to) if err != nil { diff --git a/internal/tests/integration/test_ec2_utils.go b/internal/tests/integration/test_ec2_utils.go index 0ea29ac1..1ac6aa66 100644 --- a/internal/tests/integration/test_ec2_utils.go +++ b/internal/tests/integration/test_ec2_utils.go @@ -32,7 +32,7 @@ const instanceDocument = `{ "region" : "xx-test-1" }` -func instanceDocumentHandler(w http.ResponseWriter, r *http.Request) { +func instanceDocumentHandler(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json") _, err := w.Write([]byte(instanceDocument)) if err != nil { @@ -106,7 +106,7 @@ func pkcsHandler(priv *rsa.PrivateKey, derBytes []byte) func(http.ResponseWriter } } -func stsHandler(w http.ResponseWriter, r *http.Request) { +func stsHandler(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "text/xml") _, err := w.Write([]byte(`<GetCallerIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/"> <GetCallerIdentityResult> @@ -123,7 +123,7 @@ func stsHandler(w http.ResponseWriter, r *http.Request) { } } -func ec2Handler(w http.ResponseWriter, r *http.Request) { +func ec2Handler(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "text/xml") _, err := w.Write([]byte(`<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>8f7724cf-496f-496e-8fe3-example</requestId> diff --git a/internal/texttemplate/funcs.go b/internal/texttemplate/funcs.go index 8658af6f..bacc2247 100644 --- a/internal/texttemplate/funcs.go +++ b/internal/texttemplate/funcs.go @@ -43,22 +43,22 @@ func GoSlice(item reflect.Value, indexes ...reflect.Value) (reflect.Value, error if len(indexes) > 3 { return reflect.Value{}, fmt.Errorf("too many slice indexes: %d", len(indexes)) } - var cap int + var capacity int switch item.Kind() { case reflect.String: if len(indexes) == 3 { return reflect.Value{}, fmt.Errorf("cannot 3-index slice a string") } - cap = item.Len() + capacity = item.Len() case reflect.Array, reflect.Slice: - cap = item.Cap() + capacity = item.Cap() default: return reflect.Value{}, fmt.Errorf("can't slice item of type %s", item.Type()) } // set default values for cases item[:], item[i:]. idx := [3]int{0, item.Len()} for i, index := range indexes { - x, err := indexArg(index, cap) + x, err := indexArg(index, capacity) if err != nil { return reflect.Value{}, err } diff --git a/libkv/libkv_test.go b/libkv/libkv_test.go index 7a5a909e..da0fafeb 100644 --- a/libkv/libkv_test.go +++ b/libkv/libkv_test.go @@ -29,7 +29,7 @@ type FakeStore struct { data []*store.KVPair } -func (s *FakeStore) Put(key string, value []byte, options *store.WriteOptions) error { +func (s *FakeStore) Put(_ string, _ []byte, _ *store.WriteOptions) error { return nil } @@ -46,39 +46,39 @@ func (s *FakeStore) Get(key string) (*store.KVPair, error) { return nil, nil } -func (s *FakeStore) Delete(key string) error { +func (s *FakeStore) Delete(_ string) error { return nil } -func (s *FakeStore) Exists(key string) (bool, error) { +func (s *FakeStore) Exists(_ string) (bool, error) { return false, nil } -func (s *FakeStore) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, error) { +func (s *FakeStore) Watch(_ string, _ <-chan struct{}) (<-chan *store.KVPair, error) { return nil, nil } -func (s *FakeStore) WatchTree(directory string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error) { +func (s *FakeStore) WatchTree(_ string, _ <-chan struct{}) (<-chan []*store.KVPair, error) { return nil, nil } -func (s *FakeStore) NewLock(key string, options *store.LockOptions) (store.Locker, error) { +func (s *FakeStore) NewLock(_ string, _ *store.LockOptions) (store.Locker, error) { return nil, nil } -func (s *FakeStore) List(directory string) ([]*store.KVPair, error) { +func (s *FakeStore) List(_ string) ([]*store.KVPair, error) { return nil, nil } -func (s *FakeStore) DeleteTree(directory string) error { +func (s *FakeStore) DeleteTree(_ string) error { return nil } -func (s *FakeStore) AtomicPut(key string, value []byte, previous *store.KVPair, options *store.WriteOptions) (bool, *store.KVPair, error) { +func (s *FakeStore) AtomicPut(_ string, _ []byte, _ *store.KVPair, _ *store.WriteOptions) (bool, *store.KVPair, error) { return false, nil, nil } -func (s *FakeStore) AtomicDelete(key string, previous *store.KVPair) (bool, error) { +func (s *FakeStore) AtomicDelete(_ string, _ *store.KVPair) (bool, error) { return false, nil } diff --git a/template.go b/template.go index c4c318ed..f9679b47 100644 --- a/template.go +++ b/template.go @@ -156,7 +156,7 @@ func parseNestedTemplateDir(ctx context.Context, fsys fs.FS, alias, fname string return nil } -func parseNestedTemplate(ctx context.Context, fsys fs.FS, alias, fname string, tmpl *template.Template) error { +func parseNestedTemplate(_ context.Context, fsys fs.FS, alias, fname string, tmpl *template.Template) error { b, err := fs.ReadFile(fsys, fname) if err != nil { return fmt.Errorf("readFile %q: %w", fname, err) |
