diff --git a/internal/cmd/egctl/config_test.go b/internal/cmd/egctl/config_test.go index 8d1eb45b93..b5b6b25bc3 100644 --- a/internal/cmd/egctl/config_test.go +++ b/internal/cmd/egctl/config_test.go @@ -297,7 +297,7 @@ func (f *fakeCLIClient) PodsForSelector(string, ...string) (*corev1.PodList, err return &corev1.PodList{Items: f.pods}, nil } -func (f *fakeCLIClient) PodExec(types.NamespacedName, string, string) (stdout string, stderr string, err error) { +func (f *fakeCLIClient) PodExec(types.NamespacedName, string, string) (stdout, stderr string, err error) { return "", "", nil } diff --git a/internal/cmd/egctl/stats_envoy.go b/internal/cmd/egctl/stats_envoy.go index c8b22c8d05..6a92cb3973 100644 --- a/internal/cmd/egctl/stats_envoy.go +++ b/internal/cmd/egctl/stats_envoy.go @@ -135,7 +135,7 @@ func newEnvoyStatsCmd() *cobra.Command { return statsConfigCmd } -func setupEnvoyServerStatsConfig(kubeClient kubernetes.CLIClient, podName, podNamespace string, outputFormat string) (string, error) { +func setupEnvoyServerStatsConfig(kubeClient kubernetes.CLIClient, podName, podNamespace, outputFormat string) (string, error) { path := "stats" if outputFormat == jsonOutput || outputFormat == yamlOutput { // for yaml output we will convert the json to yaml when printed @@ -161,7 +161,7 @@ func setupEnvoyServerStatsConfig(kubeClient kubernetes.CLIClient, podName, podNa return string(result), nil } -func setupEnvoyClusterStatsConfig(kubeClient kubernetes.CLIClient, podName, podNamespace string, outputFormat string) (string, error) { +func setupEnvoyClusterStatsConfig(kubeClient kubernetes.CLIClient, podName, podNamespace, outputFormat string) (string, error) { path := "clusters" if outputFormat == jsonOutput || outputFormat == yamlOutput { // for yaml output we will convert the json to yaml when printed @@ -184,7 +184,7 @@ func setupEnvoyClusterStatsConfig(kubeClient kubernetes.CLIClient, podName, podN return string(result), nil } -func statsRequest(address string, path string) ([]byte, error) { +func statsRequest(address, path string) ([]byte, error) { url := fmt.Sprintf("http://%s/%s", address, path) req, err := http.NewRequest("GET", url, nil) if err != nil { diff --git a/internal/cmd/envoy/shutdown_manager.go b/internal/cmd/envoy/shutdown_manager.go index e35793df96..f1c82dae79 100644 --- a/internal/cmd/envoy/shutdown_manager.go +++ b/internal/cmd/envoy/shutdown_manager.go @@ -115,7 +115,7 @@ func shutdownReadyHandler(w http.ResponseWriter, readyTimeout time.Duration, rea // Shutdown is called from a preStop hook on the shutdown-manager container where // it will initiate a drain sequence on the Envoy proxy and block until // connections are drained or a timeout is exceeded. -func Shutdown(drainTimeout time.Duration, minDrainDuration time.Duration, exitAtConnections int) error { +func Shutdown(drainTimeout, minDrainDuration time.Duration, exitAtConnections int) error { startTime := time.Now() allowedToExit := false diff --git a/internal/gatewayapi/ext_service.go b/internal/gatewayapi/ext_service.go index c041cdc4e6..ea59d3c9e3 100644 --- a/internal/gatewayapi/ext_service.go +++ b/internal/gatewayapi/ext_service.go @@ -150,7 +150,7 @@ func (t *Translator) processExtServiceDestination( return ds, nil } -func irIndexedExtServiceDestinationName(policyNamespacedName types.NamespacedName, policyKind string, configType string, idx int) string { +func irIndexedExtServiceDestinationName(policyNamespacedName types.NamespacedName, policyKind, configType string, idx int) string { return strings.ToLower(fmt.Sprintf( "%s/%s/%s/%s/%d", policyKind, diff --git a/internal/gatewayapi/resource/resource.go b/internal/gatewayapi/resource/resource.go index 749e2efeef..c4f2757c7d 100644 --- a/internal/gatewayapi/resource/resource.go +++ b/internal/gatewayapi/resource/resource.go @@ -170,7 +170,7 @@ func (r *Resources) GetConfigMap(namespace, name string) *corev1.ConfigMap { return nil } -func (r *Resources) GetEndpointSlicesForBackend(svcNamespace, svcName string, backendKind string) []*discoveryv1.EndpointSlice { +func (r *Resources) GetEndpointSlicesForBackend(svcNamespace, svcName, backendKind string) []*discoveryv1.EndpointSlice { var endpointSlices []*discoveryv1.EndpointSlice for _, endpointSlice := range r.EndpointSlices { var backendSelectorLabel string diff --git a/internal/gatewayapi/translator.go b/internal/gatewayapi/translator.go index 3c6158b47f..c085e78771 100644 --- a/internal/gatewayapi/translator.go +++ b/internal/gatewayapi/translator.go @@ -44,7 +44,7 @@ var _ TranslatorManager = (*Translator)(nil) type TranslatorManager interface { Translate(resources *resource.Resources) (*TranslateResult, error) - GetRelevantGateways(resources *resource.Resources) (acceptedGateways []*GatewayContext, failedGateways []*GatewayContext) + GetRelevantGateways(resources *resource.Resources) (acceptedGateways, failedGateways []*GatewayContext) RoutesTranslator ListenersTranslator @@ -255,7 +255,7 @@ func (t *Translator) Translate(resources *resource.Resources) (*TranslateResult, // GetRelevantGateways returns GatewayContexts, containing a copy of the original // Gateway with the Listener statuses reset. func (t *Translator) GetRelevantGateways(resources *resource.Resources) ( - acceptedGateways []*GatewayContext, failedGateways []*GatewayContext, + acceptedGateways, failedGateways []*GatewayContext, ) { for _, gateway := range resources.Gateways { if gateway == nil { diff --git a/internal/gatewayapi/translator_test.go b/internal/gatewayapi/translator_test.go index 28af480221..b6b6d79f01 100644 --- a/internal/gatewayapi/translator_test.go +++ b/internal/gatewayapi/translator_test.go @@ -528,7 +528,7 @@ func TestTranslateWithExtensionKinds(t *testing.T) { } } -func overrideOutputConfig(t *testing.T, data string, filepath string) { +func overrideOutputConfig(t *testing.T, data, filepath string) { t.Helper() file, err := os.OpenFile(filepath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644) require.NoError(t, err) @@ -846,7 +846,7 @@ type mockWasmCache struct{} func (m *mockWasmCache) Start(_ context.Context) {} -func (m *mockWasmCache) Get(downloadURL string, options wasm.GetOptions) (url string, checksum string, err error) { +func (m *mockWasmCache) Get(downloadURL string, options wasm.GetOptions) (url, checksum string, err error) { // This is a mock implementation of the wasm.Cache.Get method. sha := sha256.Sum256([]byte(downloadURL)) hashedName := hex.EncodeToString(sha[:]) diff --git a/internal/infrastructure/kubernetes/proxy/resource.go b/internal/infrastructure/kubernetes/proxy/resource.go index 7c096266d9..44324a0729 100644 --- a/internal/infrastructure/kubernetes/proxy/resource.go +++ b/internal/infrastructure/kubernetes/proxy/resource.go @@ -82,7 +82,7 @@ func enablePrometheus(infra *ir.ProxyInfra) bool { func expectedProxyContainers(infra *ir.ProxyInfra, containerSpec *egv1a1.KubernetesContainerSpec, shutdownConfig *egv1a1.ShutdownConfig, shutdownManager *egv1a1.ShutdownManager, - namespace string, dnsDomain string, + namespace, dnsDomain string, ) ([]corev1.Container, error) { ports := make([]corev1.ContainerPort, 0, 2) if enablePrometheus(infra) { diff --git a/internal/infrastructure/kubernetes/proxy/resource_provider.go b/internal/infrastructure/kubernetes/proxy/resource_provider.go index b06f944f46..daa318c2f6 100644 --- a/internal/infrastructure/kubernetes/proxy/resource_provider.go +++ b/internal/infrastructure/kubernetes/proxy/resource_provider.go @@ -51,7 +51,7 @@ type ResourceRender struct { ShutdownManager *egv1a1.ShutdownManager } -func NewResourceRender(ns string, dnsDomain string, infra *ir.ProxyInfra, gateway *egv1a1.EnvoyGateway) *ResourceRender { +func NewResourceRender(ns, dnsDomain string, infra *ir.ProxyInfra, gateway *egv1a1.EnvoyGateway) *ResourceRender { return &ResourceRender{ Namespace: ns, DNSDomain: dnsDomain, diff --git a/internal/infrastructure/kubernetes/ratelimit/resource.go b/internal/infrastructure/kubernetes/ratelimit/resource.go index ddcd793c48..d0cf4f4cd0 100644 --- a/internal/infrastructure/kubernetes/ratelimit/resource.go +++ b/internal/infrastructure/kubernetes/ratelimit/resource.go @@ -111,7 +111,7 @@ const ( ) // GetServiceURL returns the URL for the rate limit service. -func GetServiceURL(namespace string, dnsDomain string) string { +func GetServiceURL(namespace, dnsDomain string) string { return fmt.Sprintf("grpc://%s.%s.svc.%s:%d", InfraName, namespace, dnsDomain, InfraGRPCPort) } diff --git a/internal/kubernetes/client.go b/internal/kubernetes/client.go index 621df56d28..1d9796b9c4 100644 --- a/internal/kubernetes/client.go +++ b/internal/kubernetes/client.go @@ -37,7 +37,7 @@ type CLIClient interface { PodsForSelector(namespace string, labelSelectors ...string) (*corev1.PodList, error) // PodExec takes a command and the pod data to run the command in the specified pod. - PodExec(namespacedName types.NamespacedName, container string, command string) (stdout string, stderr string, err error) + PodExec(namespacedName types.NamespacedName, container, command string) (stdout, stderr string, err error) // Kube returns kube client. Kube() kubernetes.Interface @@ -131,7 +131,7 @@ func (c *client) Pod(namespacedName types.NamespacedName) (*corev1.Pod, error) { return c.kube.CoreV1().Pods(namespacedName.Namespace).Get(context.TODO(), namespacedName.Name, metav1.GetOptions{}) } -func (c *client) PodExec(namespacedName types.NamespacedName, container string, command string) (stdout string, stderr string, err error) { +func (c *client) PodExec(namespacedName types.NamespacedName, container, command string) (stdout, stderr string, err error) { defer func() { if err != nil { if len(stderr) > 0 { diff --git a/internal/logging/log.go b/internal/logging/log.go index 394e3919e9..bdf2f3515c 100644 --- a/internal/logging/log.go +++ b/internal/logging/log.go @@ -35,7 +35,7 @@ func NewLogger(w io.Writer, logging *egv1a1.EnvoyGatewayLogging) Logger { } } -func FileLogger(file string, name string, level egv1a1.LogLevel) Logger { +func FileLogger(file, name string, level egv1a1.LogLevel) Logger { writer, err := os.OpenFile(file, os.O_WRONLY, 0o666) if err != nil { panic(err) diff --git a/internal/provider/kubernetes/controller.go b/internal/provider/kubernetes/controller.go index b4ba3aee49..4f84c8a5f6 100644 --- a/internal/provider/kubernetes/controller.go +++ b/internal/provider/kubernetes/controller.go @@ -1941,7 +1941,7 @@ func (r *gatewayAPIReconciler) processEnvoyProxy(ep *egv1a1.EnvoyProxy, resource } // crdExists checks for the existence of the CRD in k8s APIServer before watching it -func (r *gatewayAPIReconciler) crdExists(mgr manager.Manager, kind string, groupVersion string) bool { +func (r *gatewayAPIReconciler) crdExists(mgr manager.Manager, kind, groupVersion string) bool { discoveryClient, err := discovery.NewDiscoveryClientForConfig(mgr.GetConfig()) if err != nil { r.log.Error(err, "failed to create discovery client") diff --git a/internal/provider/kubernetes/secrets.go b/internal/provider/kubernetes/secrets.go index 953127e781..e8c0f43118 100644 --- a/internal/provider/kubernetes/secrets.go +++ b/internal/provider/kubernetes/secrets.go @@ -29,7 +29,7 @@ const ( hmacSecretKey = "hmac-secret" ) -func newSecret(secretType corev1.SecretType, name string, namespace string, data map[string][]byte) corev1.Secret { +func newSecret(secretType corev1.SecretType, name, namespace string, data map[string][]byte) corev1.Secret { return corev1.Secret{ Type: secretType, TypeMeta: metav1.TypeMeta{ diff --git a/internal/troubleshoot/collect.go b/internal/troubleshoot/collect.go index a419a564f5..9e7b6dc9ec 100644 --- a/internal/troubleshoot/collect.go +++ b/internal/troubleshoot/collect.go @@ -16,7 +16,7 @@ import ( "github.com/envoyproxy/gateway/internal/troubleshoot/collect" ) -func CollectResult(ctx context.Context, restConfig *rest.Config, bundlePath string, egNamespace string) tbcollect.CollectorResult { +func CollectResult(ctx context.Context, restConfig *rest.Config, bundlePath, egNamespace string) tbcollect.CollectorResult { var result tbcollect.CollectorResult progressChan := make(chan interface{}) diff --git a/internal/troubleshoot/collect/troubleshoot_helper.go b/internal/troubleshoot/collect/troubleshoot_helper.go index 21c7baff49..7f203d9b03 100644 --- a/internal/troubleshoot/collect/troubleshoot_helper.go +++ b/internal/troubleshoot/collect/troubleshoot_helper.go @@ -87,7 +87,7 @@ func getAllNamespaces(ctx context.Context, client *kubernetes.Clientset) ([]byte return b, namespaces, nil } -func crs(ctx context.Context, dyn dynamic.Interface, client *kubernetes.Clientset, config *rest.Config, namespaces []string, includeGroups []string) (map[string][]byte, map[string]string) { +func crs(ctx context.Context, dyn dynamic.Interface, client *kubernetes.Clientset, config *rest.Config, namespaces, includeGroups []string) (map[string][]byte, map[string]string) { includeGroupSet := sets.New[string](includeGroups...) errorList := make(map[string]string) ok, err := discovery.HasResource(client, "apiextensions.k8s.io/v1", "CustomResourceDefinition") diff --git a/internal/utils/file/file.go b/internal/utils/file/file.go index da4cb67a87..5c3a8f7f4b 100644 --- a/internal/utils/file/file.go +++ b/internal/utils/file/file.go @@ -12,7 +12,7 @@ import ( ) // Write writes data into a given filepath. -func Write(data string, filepath string) error { +func Write(data, filepath string) error { file, err := os.OpenFile(filepath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644) if err != nil { return err diff --git a/internal/utils/jsonpatch/jsonpathtopointer.go b/internal/utils/jsonpatch/jsonpathtopointer.go index 18bfb56933..3898fb0790 100644 --- a/internal/utils/jsonpatch/jsonpathtopointer.go +++ b/internal/utils/jsonpatch/jsonpathtopointer.go @@ -14,7 +14,7 @@ import ( "github.com/pkg/errors" ) -func ConvertPathToPointers(jsonDoc []byte, jsonPath string, path string) ([]string, error) { +func ConvertPathToPointers(jsonDoc []byte, jsonPath, path string) ([]string, error) { var jsonPointers []string jObj, err := oj.Parse(jsonDoc) @@ -45,7 +45,7 @@ func ConvertPathToPointers(jsonDoc []byte, jsonPath string, path string) ([]stri return jsonPointers, nil } -func concat(jsonPointer string, path string) string { +func concat(jsonPointer, path string) string { if path == "" { return jsonPointer } diff --git a/internal/utils/path/path.go b/internal/utils/path/path.go index 5a0793eff1..587024315d 100644 --- a/internal/utils/path/path.go +++ b/internal/utils/path/path.go @@ -26,7 +26,7 @@ func ValidateOutputPath(outputPath string) (string, error) { } // ListDirsAndFiles return a list of directories and files from a list of paths recursively. -func ListDirsAndFiles(paths []string) (dirs sets.Set[string], files sets.Set[string]) { +func ListDirsAndFiles(paths []string) (dirs, files sets.Set[string]) { dirs, files = sets.New[string](), sets.New[string]() // Separate paths by whether is a directory or not. paths = sets.NewString(paths...).UnsortedList() diff --git a/internal/wasm/cache.go b/internal/wasm/cache.go index 7a045038f0..59169994d6 100644 --- a/internal/wasm/cache.go +++ b/internal/wasm/cache.go @@ -48,7 +48,7 @@ const ( // Cache models a Wasm module cache. type Cache interface { - Get(downloadURL string, opts GetOptions) (url string, checksum string, err error) + Get(downloadURL string, opts GetOptions) (url, checksum string, err error) Start(ctx context.Context) } @@ -171,7 +171,7 @@ func getModulePath(baseDir string, mkey moduleKey) (string, error) { } // Get returns path the local Wasm module file and its checksum. -func (c *localFileCache) Get(downloadURL string, opts GetOptions) (localFile string, checksum string, err error) { +func (c *localFileCache) Get(downloadURL string, opts GetOptions) (localFile, checksum string, err error) { // If the checksum is not provided, try to extract it from the OCI image URL. originalChecksum := opts.Checksum if len(opts.Checksum) == 0 && strings.HasPrefix(downloadURL, ociURLPrefix) { diff --git a/internal/wasm/cache_test.go b/internal/wasm/cache_test.go index 6d3edd572f..7c5e431d1c 100644 --- a/internal/wasm/cache_test.go +++ b/internal/wasm/cache_test.go @@ -905,7 +905,7 @@ func TestWasmCachePolicyChangesUsingHTTP(t *testing.T) { wantFilePath2 := generateModulePath(t, tmpDir, url2, fmt.Sprintf("%x.wasm", sha256.Sum256(binary2))) var defaultPullPolicy PullPolicy - testWasmGet := func(downloadURL string, policy PullPolicy, resourceVersion string, wantFilePath string, wantNumRequest int) { + testWasmGet := func(downloadURL string, policy PullPolicy, resourceVersion, wantFilePath string, wantNumRequest int) { t.Helper() gotFilePath, _, err := cache.Get(downloadURL, GetOptions{ ResourceName: "namespace.resource", diff --git a/internal/wasm/httpserver.go b/internal/wasm/httpserver.go index 8f25a32c53..2d346486e5 100644 --- a/internal/wasm/httpserver.go +++ b/internal/wasm/httpserver.go @@ -157,7 +157,7 @@ func (s *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { // and the checksum of the Wasm module. // EG downloads the Wasm module from its original URL, caches it locally in the // file system, and serves it through an HTTP server. -func (s *HTTPServer) Get(originalURL string, opts GetOptions) (servingURL string, checksum string, err error) { +func (s *HTTPServer) Get(originalURL string, opts GetOptions) (servingURL, checksum string, err error) { var ( mappingPath string localFile string diff --git a/internal/xds/bootstrap/util_test.go b/internal/xds/bootstrap/util_test.go index bfa5d191c4..b5cacb7afd 100644 --- a/internal/xds/bootstrap/util_test.go +++ b/internal/xds/bootstrap/util_test.go @@ -88,7 +88,7 @@ func TestApplyBootstrapConfig(t *testing.T) { } } -func loadData(caseName string, inOrOut string) (string, error) { +func loadData(caseName, inOrOut string) (string, error) { filename := path.Join("testdata", "merge", fmt.Sprintf("%s.%s.yaml", caseName, inOrOut)) b, err := os.ReadFile(filename) if err != nil { diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go index 5c268ef0b5..a051c247cc 100644 --- a/internal/xds/translator/cluster.go +++ b/internal/xds/translator/cluster.go @@ -361,7 +361,7 @@ func buildHTTPStatusRange(irStatuses []ir.HTTPStatus) []*xdstype.Int64Range { return nil } ranges := []*xdstype.Int64Range{} - sort.Slice(irStatuses, func(i int, j int) bool { + sort.Slice(irStatuses, func(i, j int) bool { return irStatuses[i] < irStatuses[j] }) var start, end int64 diff --git a/internal/xds/translator/extension.go b/internal/xds/translator/extension.go index 1fdc37d9b4..77162e14f7 100644 --- a/internal/xds/translator/extension.go +++ b/internal/xds/translator/extension.go @@ -121,7 +121,7 @@ func processExtensionPostListenerHook(tCtx *types.ResourceVersionTable, xdsListe } else if modifiedListener != nil { // Use the resource table to update the listener with the modified version returned by the extension // We're assuming that Listener names are unique. - if err := tCtx.AddOrReplaceXdsResource(resourcev3.ListenerType, modifiedListener, func(existing resourceTypes.Resource, new resourceTypes.Resource) bool { + if err := tCtx.AddOrReplaceXdsResource(resourcev3.ListenerType, modifiedListener, func(existing, new resourceTypes.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -190,7 +190,7 @@ func processExtensionPostTranslationHook(tCtx *types.ResourceVersionTable, em *e return nil } -func deepCopyPtr(src interface{}, dest interface{}) error { +func deepCopyPtr(src, dest interface{}) error { if src == nil || dest == nil { return errors.New("cannot deep copy nil pointer") } diff --git a/internal/xds/translator/ratelimit.go b/internal/xds/translator/ratelimit.go index cd2df078cf..1494d9c0b8 100644 --- a/internal/xds/translator/ratelimit.go +++ b/internal/xds/translator/ratelimit.go @@ -131,7 +131,7 @@ func (t *Translator) buildRateLimitFilter(irListener *ir.HTTPListener) []*hcmv3. } // createRateLimitFilter creates a single rate limit filter for the given domain -func createRateLimitFilter(t *Translator, irListener *ir.HTTPListener, domain string, filterName string) *hcmv3.HttpFilter { +func createRateLimitFilter(t *Translator, irListener *ir.HTTPListener, domain, filterName string) *hcmv3.HttpFilter { // Create a new rate limit filter configuration rateLimitFilterProto := &ratelimitfilterv3.RateLimit{ Domain: domain, diff --git a/internal/xds/translator/route.go b/internal/xds/translator/route.go index 722e1aa91f..7a92975848 100644 --- a/internal/xds/translator/route.go +++ b/internal/xds/translator/route.go @@ -135,7 +135,7 @@ func buildUpgradeConfig(trafficFeatures *ir.TrafficFeatures) []*routev3.RouteAct return upgradeConfigs } -func buildXdsRouteMatch(pathMatch *ir.StringMatch, headerMatches []*ir.StringMatch, queryParamMatches []*ir.StringMatch) *routev3.RouteMatch { +func buildXdsRouteMatch(pathMatch *ir.StringMatch, headerMatches, queryParamMatches []*ir.StringMatch) *routev3.RouteMatch { outMatch := &routev3.RouteMatch{} // Add a prefix match to '/' if no matches are specified diff --git a/internal/xds/types/resourceversiontable.go b/internal/xds/types/resourceversiontable.go index 253d1e29f0..dc186475bc 100644 --- a/internal/xds/types/resourceversiontable.go +++ b/internal/xds/types/resourceversiontable.go @@ -110,7 +110,7 @@ func (t *ResourceVersionTable) ValidateAll() error { // AddOrReplaceXdsResource will update an existing resource of rType according to matchFunc or add as a new resource // if none satisfy the match criteria. It will only update the first match it finds, regardless // if multiple resources satisfy the match criteria. -func (t *ResourceVersionTable) AddOrReplaceXdsResource(rType resourcev3.Type, resource types.Resource, matchFunc func(existing types.Resource, new types.Resource) bool) error { +func (t *ResourceVersionTable) AddOrReplaceXdsResource(rType resourcev3.Type, resource types.Resource, matchFunc func(existing, new types.Resource) bool) error { if t.XdsResources == nil || t.XdsResources[rType] == nil { if err := t.AddXdsResource(rType, resource); err != nil { return err diff --git a/internal/xds/types/resourceversiontable_test.go b/internal/xds/types/resourceversiontable_test.go index 5fe96253bc..5fd7a42dd1 100644 --- a/internal/xds/types/resourceversiontable_test.go +++ b/internal/xds/types/resourceversiontable_test.go @@ -270,7 +270,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { tableIn *ResourceVersionTable typeIn resourcev3.Type resourceIn types.Resource - funcIn func(existing types.Resource, new types.Resource) bool + funcIn func(existing, new types.Resource) bool tableOut *ResourceVersionTable }{ { @@ -282,7 +282,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { }, typeIn: resourcev3.ClusterType, resourceIn: testCluster, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldCluster := existing.(*clusterv3.Cluster) newCluster := new.(*clusterv3.Cluster) if newCluster == nil || oldCluster == nil { @@ -308,7 +308,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { }, typeIn: resourcev3.ClusterType, resourceIn: updatedCluster, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldCluster := existing.(*clusterv3.Cluster) newCluster := new.(*clusterv3.Cluster) if newCluster == nil || oldCluster == nil { @@ -334,7 +334,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { }, typeIn: resourcev3.EndpointType, resourceIn: testEndpoint, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldEndpoint := existing.(*endpointv3.ClusterLoadAssignment) newEndpoint := new.(*endpointv3.ClusterLoadAssignment) if newEndpoint == nil || oldEndpoint == nil { @@ -360,7 +360,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { }, typeIn: resourcev3.EndpointType, resourceIn: updatedEndpoint, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldEndpoint := existing.(*endpointv3.ClusterLoadAssignment) newEndpoint := new.(*endpointv3.ClusterLoadAssignment) if newEndpoint == nil || oldEndpoint == nil { @@ -386,7 +386,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { }, typeIn: resourcev3.ListenerType, resourceIn: testListener, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -412,7 +412,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { }, typeIn: resourcev3.ListenerType, resourceIn: updatedListener, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -436,7 +436,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { }, typeIn: resourcev3.ClusterType, resourceIn: testCluster, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldCluster := existing.(*clusterv3.Cluster) newCluster := new.(*clusterv3.Cluster) if newCluster == nil || oldCluster == nil { @@ -458,7 +458,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { tableIn: &ResourceVersionTable{}, typeIn: resourcev3.ClusterType, resourceIn: testCluster, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldCluster := existing.(*clusterv3.Cluster) newCluster := new.(*clusterv3.Cluster) if newCluster == nil || oldCluster == nil { @@ -484,7 +484,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { }, typeIn: resourcev3.RouteType, resourceIn: testRouteConfig, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -510,7 +510,7 @@ func TestAddOrReplaceXdsResource(t *testing.T) { }, typeIn: resourcev3.SecretType, resourceIn: testSecret, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -656,7 +656,7 @@ func TestInvalidAddXdsResource(t *testing.T) { tableIn *ResourceVersionTable typeIn resourcev3.Type resourceIn types.Resource - funcIn func(existing types.Resource, new types.Resource) bool + funcIn func(existing, new types.Resource) bool tableOut *ResourceVersionTable }{ { @@ -668,7 +668,7 @@ func TestInvalidAddXdsResource(t *testing.T) { }, typeIn: resourcev3.ListenerType, resourceIn: invalidListener, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -694,7 +694,7 @@ func TestInvalidAddXdsResource(t *testing.T) { }, typeIn: resourcev3.RouteType, resourceIn: invalidRouteConfig, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -716,7 +716,7 @@ func TestInvalidAddXdsResource(t *testing.T) { }, typeIn: resourcev3.ClusterType, resourceIn: invalidCluster, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldCluster := existing.(*clusterv3.Cluster) newCluster := new.(*clusterv3.Cluster) if newCluster == nil || oldCluster == nil { @@ -738,7 +738,7 @@ func TestInvalidAddXdsResource(t *testing.T) { }, typeIn: resourcev3.ClusterType, resourceIn: invalidListener, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldCluster := existing.(*clusterv3.Cluster) newCluster := new.(*clusterv3.Cluster) if newCluster == nil || oldCluster == nil { @@ -760,7 +760,7 @@ func TestInvalidAddXdsResource(t *testing.T) { }, typeIn: resourcev3.ListenerType, resourceIn: invalidCluster, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -782,7 +782,7 @@ func TestInvalidAddXdsResource(t *testing.T) { }, typeIn: resourcev3.RouteType, resourceIn: invalidCluster, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -804,7 +804,7 @@ func TestInvalidAddXdsResource(t *testing.T) { }, typeIn: resourcev3.SecretType, resourceIn: invalidRouteConfig, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -826,7 +826,7 @@ func TestInvalidAddXdsResource(t *testing.T) { }, typeIn: resourcev3.SecretType, resourceIn: invalidSecret, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldListener := existing.(*listenerv3.Listener) newListener := new.(*listenerv3.Listener) if newListener == nil || oldListener == nil { @@ -848,7 +848,7 @@ func TestInvalidAddXdsResource(t *testing.T) { }, typeIn: resourcev3.EndpointType, resourceIn: invalidEndpoint, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldEndpoint := existing.(*endpointv3.ClusterLoadAssignment) newEndpoint := new.(*endpointv3.ClusterLoadAssignment) if newEndpoint == nil || oldEndpoint == nil { @@ -870,7 +870,7 @@ func TestInvalidAddXdsResource(t *testing.T) { }, typeIn: resourcev3.EndpointType, resourceIn: invalidListener, - funcIn: func(existing types.Resource, new types.Resource) bool { + funcIn: func(existing, new types.Resource) bool { oldEndpoint := existing.(*endpointv3.ClusterLoadAssignment) newEndpoint := new.(*endpointv3.ClusterLoadAssignment) if newEndpoint == nil || oldEndpoint == nil { diff --git a/test/e2e/tests/utils.go b/test/e2e/tests/utils.go index 34b146afb0..f5545df823 100644 --- a/test/e2e/tests/utils.go +++ b/test/e2e/tests/utils.go @@ -435,7 +435,7 @@ func RetrieveMetrics(url string, timeout time.Duration) (map[string]*dto.MetricF return metricParser.TextToMetricFamilies(res.Body) } -func RetrieveMetric(url string, name string, timeout time.Duration) (*dto.MetricFamily, error) { +func RetrieveMetric(url, name string, timeout time.Duration) (*dto.MetricFamily, error) { metrics, err := RetrieveMetrics(url, timeout) if err != nil { return nil, err diff --git a/test/e2e/tests/wasm_oci.go b/test/e2e/tests/wasm_oci.go index f9f74cec21..93b2d13be9 100644 --- a/test/e2e/tests/wasm_oci.go +++ b/test/e2e/tests/wasm_oci.go @@ -352,7 +352,7 @@ func printDockerCLIResponse(rd io.Reader) error { return nil } -func createPullSecretForWasmTest(t *testing.T, suite *suite.ConformanceTestSuite, registryAddr string, password string) *corev1.Secret { +func createPullSecretForWasmTest(t *testing.T, suite *suite.ConformanceTestSuite, registryAddr, password string) *corev1.Secret { // Create Docker config JSON dockerConfigJSON := fmt.Sprintf(`{"auths":{"%s":{"username":"%s","password":"%s","email":"%s","auth":"%s"}}}`, registryAddr, dockerUsername, password, dockerEmail, @@ -380,7 +380,7 @@ func createPullSecretForWasmTest(t *testing.T, suite *suite.ConformanceTestSuite func createEEPForWasmTest( t *testing.T, suite *suite.ConformanceTestSuite, - registryAddr string, digest string, withPullSecret bool, + registryAddr, digest string, withPullSecret bool, ) *egv1a1.EnvoyExtensionPolicy { eep := &egv1a1.EnvoyExtensionPolicy{ ObjectMeta: metav1.ObjectMeta{ diff --git a/test/utils/kubernetes/kube.go b/test/utils/kubernetes/kube.go index 0660bfbc99..d3217fbad9 100644 --- a/test/utils/kubernetes/kube.go +++ b/test/utils/kubernetes/kube.go @@ -256,7 +256,7 @@ func (ka *KubeActions) CheckDeploymentReplicas(ctx context.Context, prefix, name return errors.New("deployment was not found") } -func (ka *KubeActions) getDepByPrefix(ctx context.Context, prefix string, namespace string) (*appsv1.Deployment, error) { +func (ka *KubeActions) getDepByPrefix(ctx context.Context, prefix, namespace string) (*appsv1.Deployment, error) { deployments, err := ka.Kube().AppsV1().Deployments(namespace).List(ctx, metav1.ListOptions{}) if err != nil { return nil, fmt.Errorf("failed to list deployments: %w", err)