diff --git a/cmd/common.go b/cmd/common.go index 309d0b475..ede3d0421 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -339,7 +339,7 @@ func fetchKongVersion(ctx context.Context, config utils.KongClientConfig) (strin return version, nil } -func validateNoArgs(cmd *cobra.Command, args []string) error { +func validateNoArgs(_ *cobra.Command, args []string) error { if len(args) > 0 { return fmt.Errorf("positional arguments are not valid for this command, " + "please use flags instead") diff --git a/crud/registry_test.go b/crud/registry_test.go index a62fc4253..1b20e74e1 100644 --- a/crud/registry_test.go +++ b/crud/registry_test.go @@ -29,15 +29,15 @@ func (t testActionFixture) invoke(op string, inputs ...Arg) (Arg, error) { return res, nil } -func (t testActionFixture) Create(ctx context.Context, input ...Arg) (Arg, error) { +func (t testActionFixture) Create(_ context.Context, input ...Arg) (Arg, error) { return t.invoke("create", input...) } -func (t testActionFixture) Delete(ctx context.Context, input ...Arg) (Arg, error) { +func (t testActionFixture) Delete(_ context.Context, input ...Arg) (Arg, error) { return t.invoke("delete", input...) } -func (t testActionFixture) Update(ctx context.Context, input ...Arg) (Arg, error) { +func (t testActionFixture) Update(_ context.Context, input ...Arg) (Arg, error) { return t.invoke("update", input...) } diff --git a/docs/generate-docs.go b/docs/generate-docs.go index e0bd368b8..e06d2ce91 100644 --- a/docs/generate-docs.go +++ b/docs/generate-docs.go @@ -43,10 +43,7 @@ func genMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHa if _, err := io.WriteString(f, filePrepender(filename)); err != nil { return err } - if err := genMarkdownCustom(cmd, f, linkHandler); err != nil { - return err - } - return nil + return genMarkdownCustom(cmd, f, linkHandler) } func flagUsagesWrapped(f *pflag.FlagSet) string { @@ -59,7 +56,7 @@ func flagUsagesWrapped(f *pflag.FlagSet) string { if flag.Hidden { return } - line := "" + var line string if flag.Shorthand != "" && flag.ShorthandDeprecated == "" { line = fmt.Sprintf("`-%s`, `--%s`\n:", flag.Shorthand, flag.Name) } else { diff --git a/state/konnect_types.go b/state/konnect_types.go index 6d9fcf7d4..85bd7e17e 100644 --- a/state/konnect_types.go +++ b/state/konnect_types.go @@ -35,7 +35,7 @@ func (d1 *Document) Equal(d2 *Document) bool { // If ignoreID is set to true, IDs will be ignored while comparison. // If ignoreTS is set to true, timestamp fields will be ignored. func (d1 *Document) EqualWithOpts(d2 *Document, - ignoreID, ignoreTS, ignoreForeign bool, + ignoreID, _, ignoreForeign bool, ) bool { d1Copy := d1.Document.ShallowCopy() d2Copy := d2.Document.ShallowCopy() @@ -81,7 +81,7 @@ func (s1 *ServicePackage) Equal(s2 *ServicePackage) bool { // If ignoreID is set to true, IDs will be ignored while comparison. // If ignoreTS is set to true, timestamp fields will be ignored. func (s1 *ServicePackage) EqualWithOpts(s2 *ServicePackage, - ignoreID bool, ignoreTS bool, + ignoreID bool, _ bool, ) bool { s1Copy := s1.ServicePackage.DeepCopy() s2Copy := s2.ServicePackage.DeepCopy() @@ -124,7 +124,7 @@ func (s1 *ServiceVersion) Equal(s2 *ServiceVersion) bool { // If ignoreID is set to true, IDs will be ignored while comparison. // If ignoreTS is set to true, timestamp fields will be ignored. func (s1 *ServiceVersion) EqualWithOpts(s2 *ServiceVersion, - ignoreID, ignoreTS, ignoreForeign bool, + ignoreID, _, ignoreForeign bool, ) bool { s1Copy := s1.ServiceVersion.DeepCopy() s2Copy := s2.ServiceVersion.DeepCopy() diff --git a/state/types.go b/state/types.go index 5914adbf6..88dcb5795 100644 --- a/state/types.go +++ b/state/types.go @@ -1328,7 +1328,7 @@ func (r1 *RBACRole) Equal(r2 *RBACRole) bool { // If ignoreID is set to true, IDs will be ignored while comparison. // If ignoreTS is set to true, timestamp fields will be ignored. func (r1 *RBACRole) EqualWithOpts(r2 *RBACRole, ignoreID, - ignoreTS, ignoreForeign bool, + ignoreTS, _ bool, ) bool { r1Copy := r1.RBACRole.DeepCopy() r2Copy := r2.RBACRole.DeepCopy() @@ -1377,7 +1377,7 @@ func (r1 *RBACEndpointPermission) Equal(r2 *RBACEndpointPermission) bool { // If ignoreID is set to true, IDs will be ignored while comparison. // If ignoreTS is set to true, timestamp fields will be ignored. func (r1 *RBACEndpointPermission) EqualWithOpts(r2 *RBACEndpointPermission, ignoreID, - ignoreTS, ignoreForeign bool, + ignoreTS, _ bool, ) bool { r1Copy := r1.RBACEndpointPermission.DeepCopy() r2Copy := r2.RBACEndpointPermission.DeepCopy() diff --git a/tests/integration/test_utils.go b/tests/integration/test_utils.go index 7a408ec62..8c2d2573b 100644 --- a/tests/integration/test_utils.go +++ b/tests/integration/test_utils.go @@ -200,7 +200,7 @@ func readFile(filepath string) (string, error) { return string(content), nil } -func setup(t *testing.T) func(t *testing.T) { +func setup(_ *testing.T) func(t *testing.T) { // disable analytics for integration tests os.Setenv("DECK_ANALYTICS", "off") return func(t *testing.T) { diff --git a/types/consumer_group_plugin.go b/types/consumer_group_plugin.go index be7fa791a..4290e5c66 100644 --- a/types/consumer_group_plugin.go +++ b/types/consumer_group_plugin.go @@ -119,7 +119,7 @@ type consumerGroupPluginDiffer struct { currentState, targetState *state.KongState } -func (d *consumerGroupPluginDiffer) Deletes(handler func(crud.Event) error) error { +func (d *consumerGroupPluginDiffer) Deletes(_ func(crud.Event) error) error { return nil } diff --git a/types/postProcess.go b/types/postProcess.go index af84fc476..2ec5e9f6e 100644 --- a/types/postProcess.go +++ b/types/postProcess.go @@ -11,15 +11,15 @@ type servicePostAction struct { currentState *state.KongState } -func (crud *servicePostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *servicePostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Services.Add(*args[0].(*state.Service)) } -func (crud *servicePostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *servicePostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Services.Delete(*((args[0].(*state.Service)).ID)) } -func (crud *servicePostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *servicePostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Services.Update(*args[0].(*state.Service)) } @@ -27,15 +27,15 @@ type routePostAction struct { currentState *state.KongState } -func (crud *routePostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *routePostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Routes.Add(*args[0].(*state.Route)) } -func (crud *routePostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *routePostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Routes.Delete(*((args[0].(*state.Route)).ID)) } -func (crud *routePostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *routePostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Routes.Update(*args[0].(*state.Route)) } @@ -43,15 +43,15 @@ type upstreamPostAction struct { currentState *state.KongState } -func (crud *upstreamPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *upstreamPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Upstreams.Add(*args[0].(*state.Upstream)) } -func (crud *upstreamPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *upstreamPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Upstreams.Delete(*((args[0].(*state.Upstream)).ID)) } -func (crud *upstreamPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *upstreamPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Upstreams.Update(*args[0].(*state.Upstream)) } @@ -59,16 +59,16 @@ type targetPostAction struct { currentState *state.KongState } -func (crud *targetPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *targetPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Targets.Add(*args[0].(*state.Target)) } -func (crud *targetPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *targetPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { target := args[0].(*state.Target) return nil, crud.currentState.Targets.Delete(*target.Upstream.ID, *target.ID) } -func (crud *targetPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *targetPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Targets.Update(*args[0].(*state.Target)) } @@ -76,15 +76,15 @@ type certificatePostAction struct { currentState *state.KongState } -func (crud *certificatePostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *certificatePostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Certificates.Add(*args[0].(*state.Certificate)) } -func (crud *certificatePostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *certificatePostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Certificates.Delete(*((args[0].(*state.Certificate)).ID)) } -func (crud *certificatePostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *certificatePostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Certificates.Update(*args[0].(*state.Certificate)) } @@ -92,16 +92,16 @@ type sniPostAction struct { currentState *state.KongState } -func (crud *sniPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *sniPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.SNIs.Add(*args[0].(*state.SNI)) } -func (crud *sniPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *sniPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { sni := args[0].(*state.SNI) return nil, crud.currentState.SNIs.Delete(*sni.ID) } -func (crud *sniPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *sniPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.SNIs.Update(*args[0].(*state.SNI)) } @@ -109,15 +109,15 @@ type caCertificatePostAction struct { currentState *state.KongState } -func (crud *caCertificatePostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *caCertificatePostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.CACertificates.Add(*args[0].(*state.CACertificate)) } -func (crud *caCertificatePostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *caCertificatePostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.CACertificates.Delete(*((args[0].(*state.CACertificate)).ID)) } -func (crud *caCertificatePostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *caCertificatePostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.CACertificates.Update(*args[0].(*state.CACertificate)) } @@ -125,15 +125,15 @@ type pluginPostAction struct { currentState *state.KongState } -func (crud *pluginPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *pluginPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Plugins.Add(*args[0].(*state.Plugin)) } -func (crud *pluginPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *pluginPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Plugins.Delete(*((args[0].(*state.Plugin)).ID)) } -func (crud *pluginPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *pluginPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Plugins.Update(*args[0].(*state.Plugin)) } @@ -141,15 +141,15 @@ type consumerPostAction struct { currentState *state.KongState } -func (crud *consumerPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Consumers.Add(*args[0].(*state.Consumer)) } -func (crud *consumerPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Consumers.Delete(*((args[0].(*state.Consumer)).ID)) } -func (crud *consumerPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Consumers.Update(*args[0].(*state.Consumer)) } @@ -157,15 +157,15 @@ type consumerGroupPostAction struct { currentState *state.KongState } -func (crud *consumerGroupPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerGroupPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ConsumerGroups.Add(*args[0].(*state.ConsumerGroup)) } -func (crud *consumerGroupPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerGroupPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ConsumerGroups.Delete(*((args[0].(*state.ConsumerGroup)).ID)) } -func (crud *consumerGroupPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerGroupPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ConsumerGroups.Update(*args[0].(*state.ConsumerGroup)) } @@ -173,18 +173,18 @@ type consumerGroupConsumerPostAction struct { currentState *state.KongState } -func (crud *consumerGroupConsumerPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerGroupConsumerPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ConsumerGroupConsumers.Add(*args[0].(*state.ConsumerGroupConsumer)) } -func (crud *consumerGroupConsumerPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerGroupConsumerPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ConsumerGroupConsumers.Delete( *((args[0].(*state.ConsumerGroupConsumer)).Consumer.ID), *((args[0].(*state.ConsumerGroupConsumer)).ConsumerGroup.ID), ) } -func (crud *consumerGroupConsumerPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerGroupConsumerPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ConsumerGroupConsumers.Update(*args[0].(*state.ConsumerGroupConsumer)) } @@ -192,18 +192,18 @@ type consumerGroupPluginPostAction struct { currentState *state.KongState } -func (crud *consumerGroupPluginPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerGroupPluginPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ConsumerGroupPlugins.Add(*args[0].(*state.ConsumerGroupPlugin)) } -func (crud *consumerGroupPluginPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerGroupPluginPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ConsumerGroupPlugins.Delete( *((args[0].(*state.ConsumerGroupPlugin)).ID), *((args[0].(*state.ConsumerGroupConsumer)).ConsumerGroup.ID), ) } -func (crud *consumerGroupPluginPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *consumerGroupPluginPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ConsumerGroupPlugins.Update(*args[0].(*state.ConsumerGroupPlugin)) } @@ -211,15 +211,15 @@ type keyAuthPostAction struct { currentState *state.KongState } -func (crud *keyAuthPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *keyAuthPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.KeyAuths.Add(*args[0].(*state.KeyAuth)) } -func (crud *keyAuthPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *keyAuthPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.KeyAuths.Delete(*((args[0].(*state.KeyAuth)).ID)) } -func (crud *keyAuthPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *keyAuthPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.KeyAuths.Update(*args[0].(*state.KeyAuth)) } @@ -227,15 +227,15 @@ type hmacAuthPostAction struct { currentState *state.KongState } -func (crud hmacAuthPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud hmacAuthPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.HMACAuths.Add(*args[0].(*state.HMACAuth)) } -func (crud hmacAuthPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud hmacAuthPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.HMACAuths.Delete(*((args[0].(*state.HMACAuth)).ID)) } -func (crud hmacAuthPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud hmacAuthPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.HMACAuths.Update(*args[0].(*state.HMACAuth)) } @@ -243,15 +243,15 @@ type jwtAuthPostAction struct { currentState *state.KongState } -func (crud jwtAuthPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud jwtAuthPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.JWTAuths.Add(*args[0].(*state.JWTAuth)) } -func (crud jwtAuthPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud jwtAuthPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.JWTAuths.Delete(*((args[0].(*state.JWTAuth)).ID)) } -func (crud jwtAuthPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud jwtAuthPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.JWTAuths.Update(*args[0].(*state.JWTAuth)) } @@ -259,15 +259,15 @@ type basicAuthPostAction struct { currentState *state.KongState } -func (crud basicAuthPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud basicAuthPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.BasicAuths.Add(*args[0].(*state.BasicAuth)) } -func (crud basicAuthPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud basicAuthPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.BasicAuths.Delete(*((args[0].(*state.BasicAuth)).ID)) } -func (crud basicAuthPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud basicAuthPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.BasicAuths.Update(*args[0].(*state.BasicAuth)) } @@ -275,15 +275,15 @@ type aclGroupPostAction struct { currentState *state.KongState } -func (crud aclGroupPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud aclGroupPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ACLGroups.Add(*args[0].(*state.ACLGroup)) } -func (crud aclGroupPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud aclGroupPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ACLGroups.Delete(*((args[0].(*state.ACLGroup)).ID)) } -func (crud aclGroupPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud aclGroupPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ACLGroups.Update(*args[0].(*state.ACLGroup)) } @@ -291,15 +291,15 @@ type oauth2CredPostAction struct { currentState *state.KongState } -func (crud oauth2CredPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud oauth2CredPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Oauth2Creds.Add(*args[0].(*state.Oauth2Credential)) } -func (crud oauth2CredPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud oauth2CredPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Oauth2Creds.Delete(*((args[0].(*state.Oauth2Credential)).ID)) } -func (crud oauth2CredPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud oauth2CredPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Oauth2Creds.Update(*args[0].(*state.Oauth2Credential)) } @@ -307,15 +307,15 @@ type mtlsAuthPostAction struct { currentState *state.KongState } -func (crud *mtlsAuthPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *mtlsAuthPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.MTLSAuths.Add(*args[0].(*state.MTLSAuth)) } -func (crud *mtlsAuthPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *mtlsAuthPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.MTLSAuths.Delete(*((args[0].(*state.MTLSAuth)).ID)) } -func (crud *mtlsAuthPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *mtlsAuthPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.MTLSAuths.Update(*args[0].(*state.MTLSAuth)) } @@ -323,15 +323,15 @@ type rbacRolePostAction struct { currentState *state.KongState } -func (crud *rbacRolePostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *rbacRolePostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.RBACRoles.Add(*args[0].(*state.RBACRole)) } -func (crud *rbacRolePostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *rbacRolePostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.RBACRoles.Delete(*((args[0].(*state.RBACRole)).ID)) } -func (crud *rbacRolePostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *rbacRolePostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.RBACRoles.Update(*args[0].(*state.RBACRole)) } @@ -339,15 +339,15 @@ type rbacEndpointPermissionPostAction struct { currentState *state.KongState } -func (crud *rbacEndpointPermissionPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *rbacEndpointPermissionPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.RBACEndpointPermissions.Add(*args[0].(*state.RBACEndpointPermission)) } -func (crud *rbacEndpointPermissionPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *rbacEndpointPermissionPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.RBACEndpointPermissions.Delete(args[0].(*state.RBACEndpointPermission).FriendlyName()) } -func (crud *rbacEndpointPermissionPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud *rbacEndpointPermissionPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.RBACEndpointPermissions.Update(*args[0].(*state.RBACEndpointPermission)) } @@ -355,15 +355,15 @@ type servicePackagePostAction struct { currentState *state.KongState } -func (crud servicePackagePostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud servicePackagePostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ServicePackages.Add(*args[0].(*state.ServicePackage)) } -func (crud servicePackagePostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud servicePackagePostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ServicePackages.Delete(*((args[0].(*state.ServicePackage)).ID)) } -func (crud servicePackagePostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud servicePackagePostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ServicePackages.Update(*args[0].(*state.ServicePackage)) } @@ -371,16 +371,16 @@ type serviceVersionPostAction struct { currentState *state.KongState } -func (crud serviceVersionPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud serviceVersionPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ServiceVersions.Add(*args[0].(*state.ServiceVersion)) } -func (crud serviceVersionPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud serviceVersionPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { sv := args[0].(*state.ServiceVersion) return nil, crud.currentState.ServiceVersions.Delete(*sv.ServicePackage.ID, *sv.ID) } -func (crud serviceVersionPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud serviceVersionPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.ServiceVersions.Update(*args[0].(*state.ServiceVersion)) } @@ -388,16 +388,16 @@ type documentPostAction struct { currentState *state.KongState } -func (crud documentPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud documentPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Documents.Add(*args[0].(*state.Document)) } -func (crud documentPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud documentPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { d := args[0].(*state.Document) return nil, crud.currentState.Documents.DeleteByParent(d.Parent, *d.ID) } -func (crud documentPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud documentPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Documents.Update(*args[0].(*state.Document)) } @@ -405,14 +405,14 @@ type vaultPostAction struct { currentState *state.KongState } -func (crud vaultPostAction) Create(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud vaultPostAction) Create(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Vaults.Add(*args[0].(*state.Vault)) } -func (crud vaultPostAction) Delete(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud vaultPostAction) Delete(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Vaults.Delete(*((args[0].(*state.Vault)).ID)) } -func (crud vaultPostAction) Update(ctx context.Context, args ...crud.Arg) (crud.Arg, error) { +func (crud vaultPostAction) Update(_ context.Context, args ...crud.Arg) (crud.Arg, error) { return nil, crud.currentState.Vaults.Update(*args[0].(*state.Vault)) } diff --git a/utils/types.go b/utils/types.go index 3c0649bdb..a4d377df1 100644 --- a/utils/types.go +++ b/utils/types.go @@ -163,7 +163,7 @@ func backoffStrategy(min, max time.Duration, attemptNum int, resp *http.Response // retryPolicy provides a callback for Client.CheckRetry, which // will retry on 429s errors. -func retryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error) { +func retryPolicy(ctx context.Context, resp *http.Response, _ error) (bool, error) { // do not retry on context.Canceled or context.DeadlineExceeded if ctx.Err() != nil { return false, ctx.Err()