From b3a83a8699ea370bd8c4565fd50f67d730da0040 Mon Sep 17 00:00:00 2001 From: Tim Ramlot <42113979+inteon@users.noreply.github.com> Date: Sat, 7 Jun 2025 00:21:57 +0200 Subject: [PATCH] enable spelling linters and fix spelling mistakes Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com> --- .golangci.yaml | 2 -- api/datareading.go | 2 +- cmd/root.go | 2 +- pkg/agent/config.go | 6 +++--- pkg/agent/config_test.go | 2 +- pkg/agent/run.go | 2 +- pkg/client/client_venconn_test.go | 2 ++ pkg/datagatherer/k8s/dynamic.go | 2 +- .../identity/advance_authentication_test.go | 14 +++++++------- pkg/internal/cyberark/identity/identity.go | 6 +++--- pkg/internal/cyberark/identity/mock.go | 4 ++-- .../cyberark/identity/start_authentication_test.go | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 7940a719..07a59209 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -7,14 +7,12 @@ linters: rules: - linters: - bodyclose - - dupword - errcheck - errchkjson - forbidigo - gocritic - gosec - govet - - misspell - musttag - nilerr - noctx diff --git a/api/datareading.go b/api/datareading.go index ddb771b7..54637f3c 100644 --- a/api/datareading.go +++ b/api/datareading.go @@ -15,7 +15,7 @@ type DataReadingsPost struct { // DataReading is the output of a DataGatherer. type DataReading struct { - // ClusterID is optional as it can be infered from the agent + // ClusterID is optional as it can be inferred from the agent // token when using basic authentication. ClusterID string `json:"cluster_id,omitempty"` DataGatherer string `json:"data-gatherer"` diff --git a/cmd/root.go b/cmd/root.go index 1c78a0c8..f707ac24 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -43,7 +43,7 @@ func init() { // Execute adds all child commands to the root command and sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. // If the root command or sub-command returns an error, the error message will -// will be logged and the process will exit with status 1. +// be logged and the process will exit with status 1. func Execute() { logs.AddFlags(rootCmd.PersistentFlags()) ctx := klog.NewContext(context.Background(), klog.Background()) diff --git a/pkg/agent/config.go b/pkg/agent/config.go index ff0bb4c9..252e3ff2 100644 --- a/pkg/agent/config.go +++ b/pkg/agent/config.go @@ -350,7 +350,7 @@ func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags) { } // TLSPKMode controls how to authenticate to TLSPK / Jetstack Secure. Only one -// TLSPKMode may be provided if using using those backends. +// TLSPKMode may be provided if using those backends. type TLSPKMode string const ( @@ -738,11 +738,11 @@ func validateCredsAndCreateClient(log logr.Logger, flagCredentialsPath, flagClie var creds client.Credentials if flagClientID != "" && flagCredentialsPath != "" { - errs = multierror.Append(errs, fmt.Errorf("--client-id and --credentials-file cannot be used simultanously")) + errs = multierror.Append(errs, fmt.Errorf("--client-id and --credentials-file cannot be used simultaneously")) break } if flagPrivateKeyPath != "" && flagCredentialsPath != "" { - errs = multierror.Append(errs, fmt.Errorf("--private-key-path and --credentials-file cannot be used simultanously")) + errs = multierror.Append(errs, fmt.Errorf("--private-key-path and --credentials-file cannot be used simultaneously")) break } if flagClientID == "" && flagPrivateKeyPath == "" && flagCredentialsPath == "" { diff --git a/pkg/agent/config_test.go b/pkg/agent/config_test.go index c07310b8..61cd1606 100644 --- a/pkg/agent/config_test.go +++ b/pkg/agent/config_test.go @@ -634,7 +634,7 @@ func Test_ValidateAndCombineConfig(t *testing.T) { assert.Equal(t, true, got.MachineHubMode) }) - t.Run("machinehub + venafi-cloud-keypair-auth should work simultanously", func(t *testing.T) { + t.Run("machinehub + venafi-cloud-keypair-auth should work simultaneously", func(t *testing.T) { t.Setenv("POD_NAMESPACE", "venafi") t.Setenv("KUBECONFIG", withFile(t, fakeKubeconfig)) privKeyPath := withFile(t, fakePrivKeyPEM) diff --git a/pkg/agent/run.go b/pkg/agent/run.go index 69f8528a..2d6d0456 100644 --- a/pkg/agent/run.go +++ b/pkg/agent/run.go @@ -111,7 +111,7 @@ func Run(cmd *cobra.Command, args []string) (returnErr error) { } // Health check endpoint. Since we haven't figured a good way of knowning - // what "ready" means for the agent, we just return 200 OK inconditionally. + // what "ready" means for the agent, we just return 200 OK unconditionally. // The goal is to satisfy some Kubernetes distributions, like OpenShift, // that require a liveness and health probe to be present for each pod. log.Info("Healthz endpoints enabled", "path", "/healthz") diff --git a/pkg/client/client_venconn_test.go b/pkg/client/client_venconn_test.go index 17cd5a53..f857cf91 100644 --- a/pkg/client/client_venconn_test.go +++ b/pkg/client/client_venconn_test.go @@ -300,6 +300,8 @@ func run_TestVenConnClient_PostDataReadingsWithOptions(ctx context.Context, rest // sub-test-has-special-chars-and-is-also-super-super-super-super- // // Only the last part of the test name is used. +// +// nolint:dupword func testNameToNamespace(t testing.TB) string { regex := regexp.MustCompile("[^a-zA-Z0-9-]") diff --git a/pkg/datagatherer/k8s/dynamic.go b/pkg/datagatherer/k8s/dynamic.go index 2a40d605..3df1c003 100644 --- a/pkg/datagatherer/k8s/dynamic.go +++ b/pkg/datagatherer/k8s/dynamic.go @@ -473,7 +473,7 @@ func RemoveUnstructuredKeys(excludeKeys []*regexp.Regexp, obj *unstructured.Unst return } - // The field may be nil since yaml.Unmarshal's omitempty might not be set on + // The field may be nil since yaml.Unmarshal's omitempty might not be set // on this struct field. if annotsRaw == nil { return diff --git a/pkg/internal/cyberark/identity/advance_authentication_test.go b/pkg/internal/cyberark/identity/advance_authentication_test.go index 571f9674..ef031daa 100644 --- a/pkg/internal/cyberark/identity/advance_authentication_test.go +++ b/pkg/internal/cyberark/identity/advance_authentication_test.go @@ -24,7 +24,7 @@ func Test_IdentityAdvanceAuthentication(t *testing.T) { MechanismID: successMechanismID, SessionID: successSessionID, TenantID: "foo", - PersistantLogin: true, + PersistentLogin: true, }, expectedError: nil, @@ -37,7 +37,7 @@ func Test_IdentityAdvanceAuthentication(t *testing.T) { MechanismID: successMechanismID, SessionID: successSessionID, TenantID: "foo", - PersistantLogin: true, + PersistentLogin: true, }, expectedError: fmt.Errorf(`got a failure response from request to advance authentication: message="Authentication (login or challenge) has failed. Please try again or contact your system administrator.", error="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:55555555555555555555555555555555"`), @@ -50,7 +50,7 @@ func Test_IdentityAdvanceAuthentication(t *testing.T) { MechanismID: successMechanismID, SessionID: successSessionID, TenantID: "foo", - PersistantLogin: true, + PersistentLogin: true, }, expectedError: fmt.Errorf(`got a failure response from request to advance authentication: message="Authentication (login or challenge) has failed. Please try again or contact your system administrator.", error="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:55555555555555555555555555555555"`), @@ -63,7 +63,7 @@ func Test_IdentityAdvanceAuthentication(t *testing.T) { MechanismID: "foo", SessionID: successSessionID, TenantID: "foo", - PersistantLogin: true, + PersistentLogin: true, }, expectedError: fmt.Errorf(`got a failure response from request to advance authentication: message="Authentication (login or challenge) has failed. Please try again or contact your system administrator.", error="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:55555555555555555555555555555555"`), @@ -76,12 +76,12 @@ func Test_IdentityAdvanceAuthentication(t *testing.T) { MechanismID: successMechanismID, SessionID: "foo", TenantID: "foo", - PersistantLogin: true, + PersistentLogin: true, }, expectedError: fmt.Errorf(`got a failure response from request to advance authentication: message="Authentication (login or challenge) has failed. Please try again or contact your system administrator.", error="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:55555555555555555555555555555555"`), }, - "persistant login not set": { + "persistent login not set": { username: successUser, password: []byte(successPassword), advanceBody: advanceAuthenticationRequestBody{ @@ -89,7 +89,7 @@ func Test_IdentityAdvanceAuthentication(t *testing.T) { MechanismID: successMechanismID, SessionID: successSessionID, TenantID: "foo", - PersistantLogin: false, + PersistentLogin: false, }, expectedError: fmt.Errorf("got unexpected status code 403 Forbidden from request to advance authentication in CyberArk Identity API"), diff --git a/pkg/internal/cyberark/identity/identity.go b/pkg/internal/cyberark/identity/identity.go index d1b1ba77..726792b0 100644 --- a/pkg/internal/cyberark/identity/identity.go +++ b/pkg/internal/cyberark/identity/identity.go @@ -156,9 +156,9 @@ type advanceAuthenticationRequestBody struct { // get the Identity API URL, but we set it anyway to be explicit. TenantID string `json:"TenantId"` - // PersistantLogin is documented to "[indicate] whether the session should persist after the user + // PersistentLogin is documented to "[indicate] whether the session should persist after the user // closes the browser"; for service-to-service auth which we're trying to do, we set this to true. - PersistantLogin bool `json:"PersistantLogin"` + PersistentLogin bool `json:"PersistentLogin"` } // advanceAuthenticationResponseResult is the specific information returned for a successful AdvanceAuthentication call @@ -370,7 +370,7 @@ func (c *Client) doStartAuthentication(ctx context.Context, username string) (ad response.MechanismID = mechanism.MechanismID response.SessionID = startAuthResponse.Result.SessionID response.TenantID = c.subdomain - response.PersistantLogin = true + response.PersistentLogin = true return response, nil } diff --git a/pkg/internal/cyberark/identity/mock.go b/pkg/internal/cyberark/identity/mock.go index cdcfe861..cb65e0ad 100644 --- a/pkg/internal/cyberark/identity/mock.go +++ b/pkg/internal/cyberark/identity/mock.go @@ -189,11 +189,11 @@ func (mis *mockIdentityServer) handleAdvanceAuthentication(w http.ResponseWriter // Important: The actual server will return 200 OK even if the login fails. // Most failure responses should copy that. - if !advanceBody.PersistantLogin { + if !advanceBody.PersistentLogin { // this is something we enforce but wouldn't actually be an error from // a real server, so we return a different error here w.WriteHeader(http.StatusForbidden) - _, _ = w.Write([]byte(`expected PersistantLogin to be true`)) + _, _ = w.Write([]byte(`expected PersistentLogin to be true`)) return } diff --git a/pkg/internal/cyberark/identity/start_authentication_test.go b/pkg/internal/cyberark/identity/start_authentication_test.go index 87dc2b3f..92ba150e 100644 --- a/pkg/internal/cyberark/identity/start_authentication_test.go +++ b/pkg/internal/cyberark/identity/start_authentication_test.go @@ -88,8 +88,8 @@ func Test_IdentityStartAuthentication(t *testing.T) { t.Errorf("expected advanceAuthenticationRequestBody.Action to be %s but got %s", ActionAnswer, advanceBody.Action) } - if !advanceBody.PersistantLogin { - t.Error("expected advanceAuthenticationRequestBody.PersistantLogin to be true but it wasn't") + if !advanceBody.PersistentLogin { + t.Error("expected advanceAuthenticationRequestBody.PersistentLogin to be true but it wasn't") } })