From 993605d01cfa5671182e3d149a730b721cd92c50 Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Tue, 26 Nov 2024 12:51:20 +1000 Subject: [PATCH] Fix lint --- cmd/skpr-k8s-mutate-nodeselector/main.go | 3 ++- internal/mutator/handler.go | 2 ++ internal/mutator/handler_test.go | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/skpr-k8s-mutate-nodeselector/main.go b/cmd/skpr-k8s-mutate-nodeselector/main.go index 7c485f0..9f96f4a 100644 --- a/cmd/skpr-k8s-mutate-nodeselector/main.go +++ b/cmd/skpr-k8s-mutate-nodeselector/main.go @@ -1,3 +1,4 @@ +// Package main is the entrypoint for our program. package main import ( @@ -44,7 +45,7 @@ func main() { Short: "Run the mutating webhook server", Long: cmdLong, Example: cmdExample, - RunE: func(cmd *cobra.Command, _ []string) error { + RunE: func(_ *cobra.Command, _ []string) error { logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{})) logger.Info("Starting server") diff --git a/internal/mutator/handler.go b/internal/mutator/handler.go index 82cee8f..cdb471e 100644 --- a/internal/mutator/handler.go +++ b/internal/mutator/handler.go @@ -1,3 +1,4 @@ +// Package mutator for handling mutation requests. package mutator import ( @@ -17,6 +18,7 @@ import ( // Annotation used to declare where a Pod should be scheduled. const annotation = "k8s-mutate-nodeselector.skpr.io/namespace" +// Handler for responding to mutation requests. type Handler struct { logger *slog.Logger client clientcorev1.NamespaceInterface diff --git a/internal/mutator/handler_test.go b/internal/mutator/handler_test.go index ba2f52f..fb30853 100644 --- a/internal/mutator/handler_test.go +++ b/internal/mutator/handler_test.go @@ -26,7 +26,7 @@ type MockNamespaceClient struct { } // Get a mock response of namespace and error. -func (m *MockNamespaceClient) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.Namespace, error) { +func (m *MockNamespaceClient) Get(_ context.Context, _ string, _ metav1.GetOptions) (*corev1.Namespace, error) { return m.Namespace, m.Error }