mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Merge pull request #99288 from supriya-premkumar/ineffassign
Adds ineffassign to GO linter script.
This commit is contained in:
commit
7b0ad65d4d
@ -49,4 +49,5 @@ golangci-lint run \
|
|||||||
--disable-all \
|
--disable-all \
|
||||||
-E deadcode \
|
-E deadcode \
|
||||||
-E unused \
|
-E unused \
|
||||||
-E varcheck
|
-E varcheck \
|
||||||
|
-E ineffassign
|
||||||
|
@ -362,6 +362,7 @@ func Convert_autoscaling_HorizontalPodAutoscaler_To_v1_HorizontalPodAutoscaler(i
|
|||||||
}
|
}
|
||||||
// copy before mutating
|
// copy before mutating
|
||||||
if !copiedAnnotations {
|
if !copiedAnnotations {
|
||||||
|
//nolint:ineffassign
|
||||||
copiedAnnotations = true
|
copiedAnnotations = true
|
||||||
out.Annotations = autoscaling.DeepCopyStringMap(out.Annotations)
|
out.Annotations = autoscaling.DeepCopyStringMap(out.Annotations)
|
||||||
}
|
}
|
||||||
|
@ -299,6 +299,7 @@ func Convert_autoscaling_HorizontalPodAutoscaler_To_v2beta1_HorizontalPodAutosca
|
|||||||
}
|
}
|
||||||
// copy before mutating
|
// copy before mutating
|
||||||
if !copiedAnnotations {
|
if !copiedAnnotations {
|
||||||
|
//nolint:ineffassign
|
||||||
copiedAnnotations = true
|
copiedAnnotations = true
|
||||||
out.Annotations = autoscaling.DeepCopyStringMap(out.Annotations)
|
out.Annotations = autoscaling.DeepCopyStringMap(out.Annotations)
|
||||||
}
|
}
|
||||||
|
@ -1125,7 +1125,11 @@ func TestDeleteControllerAndExpectations(t *testing.T) {
|
|||||||
manager.deleteRS(rs)
|
manager.deleteRS(rs)
|
||||||
manager.syncReplicaSet(GetKey(rs, t))
|
manager.syncReplicaSet(GetKey(rs, t))
|
||||||
|
|
||||||
if _, exists, err = manager.expectations.GetExpectations(rsKey); exists {
|
_, exists, err = manager.expectations.GetExpectations(rsKey)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Failed to get controllee expectations: %v", err)
|
||||||
|
}
|
||||||
|
if exists {
|
||||||
t.Errorf("Found expectations, expected none since the ReplicaSet has been deleted.")
|
t.Errorf("Found expectations, expected none since the ReplicaSet has been deleted.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ func NewGenericREST(optsGetter generic.RESTOptionsGetter, serviceCIDR net.IPNet,
|
|||||||
|
|
||||||
ipv4 := api.IPv4Protocol
|
ipv4 := api.IPv4Protocol
|
||||||
ipv6 := api.IPv6Protocol
|
ipv6 := api.IPv6Protocol
|
||||||
var primaryIPFamily *api.IPFamily = nil
|
var primaryIPFamily *api.IPFamily
|
||||||
var secondaryFamily *api.IPFamily = nil
|
var secondaryFamily *api.IPFamily
|
||||||
if netutil.IsIPv6CIDR(&serviceCIDR) {
|
if netutil.IsIPv6CIDR(&serviceCIDR) {
|
||||||
primaryIPFamily = &ipv6
|
primaryIPFamily = &ipv6
|
||||||
if hasSecondary {
|
if hasSecondary {
|
||||||
|
@ -192,7 +192,7 @@ func deleteTaints(taintsToRemove []v1.Taint, newTaints *[]v1.Taint) ([]error, bo
|
|||||||
allErrs := []error{}
|
allErrs := []error{}
|
||||||
var removed bool
|
var removed bool
|
||||||
for _, taintToRemove := range taintsToRemove {
|
for _, taintToRemove := range taintsToRemove {
|
||||||
removed = false
|
removed = false // nolint:ineffassign
|
||||||
if len(taintToRemove.Effect) > 0 {
|
if len(taintToRemove.Effect) > 0 {
|
||||||
*newTaints, removed = DeleteTaint(*newTaints, &taintToRemove)
|
*newTaints, removed = DeleteTaint(*newTaints, &taintToRemove)
|
||||||
} else {
|
} else {
|
||||||
|
@ -102,7 +102,6 @@ func (m *azureDiskMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) e
|
|||||||
klog.Errorf("azureDisk - Unmount directory %s failed with %v", dir, err)
|
klog.Errorf("azureDisk - Unmount directory %s failed with %v", dir, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
mountPoint = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
|
@ -321,15 +321,12 @@ func dialHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
var dialer func(string, net.Addr) (string, error)
|
var dialer func(string, net.Addr) (string, error)
|
||||||
switch strings.ToLower(protocol) {
|
switch strings.ToLower(protocol) {
|
||||||
case "", "http":
|
case "", "http":
|
||||||
protocol = "http"
|
|
||||||
dialer = dialHTTP
|
dialer = dialHTTP
|
||||||
addr, err = net.ResolveTCPAddr("tcp", hostPort)
|
addr, err = net.ResolveTCPAddr("tcp", hostPort)
|
||||||
case "udp":
|
case "udp":
|
||||||
protocol = "udp"
|
|
||||||
dialer = dialUDP
|
dialer = dialUDP
|
||||||
addr, err = net.ResolveUDPAddr("udp", hostPort)
|
addr, err = net.ResolveUDPAddr("udp", hostPort)
|
||||||
case "sctp":
|
case "sctp":
|
||||||
protocol = "sctp"
|
|
||||||
dialer = dialSCTP
|
dialer = dialSCTP
|
||||||
addr, err = sctp.ResolveSCTPAddr("sctp", hostPort)
|
addr, err = sctp.ResolveSCTPAddr("sctp", hostPort)
|
||||||
default:
|
default:
|
||||||
|
@ -1299,11 +1299,6 @@ func TestAPICRDProtobuf(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
rv, _ := strconv.Atoi(obj.GetResourceVersion())
|
|
||||||
if rv < 1 {
|
|
||||||
rv = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
w, err := client.Get().
|
w, err := client.Get().
|
||||||
Resource(resource).NamespaceIfScoped(obj.GetNamespace(), len(obj.GetNamespace()) > 0).Name(obj.GetName()).SubResource(tc.subresource).
|
Resource(resource).NamespaceIfScoped(obj.GetNamespace(), len(obj.GetNamespace()) > 0).Name(obj.GetName()).SubResource(tc.subresource).
|
||||||
SetHeader("Accept", tc.accept).
|
SetHeader("Accept", tc.accept).
|
||||||
|
@ -224,12 +224,11 @@ func TestDeploymentSelectorImmutability(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// test to ensure apps/v1 selector is immutable
|
// test to ensure apps/v1 selector is immutable
|
||||||
newSelectorLabels := map[string]string{"name_apps_v1beta1": "test_apps_v1beta1"}
|
|
||||||
deploymentAppsV1, err := c.AppsV1().Deployments(ns.Name).Get(context.TODO(), name, metav1.GetOptions{})
|
deploymentAppsV1, err := c.AppsV1().Deployments(ns.Name).Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to get apps/v1 deployment %s: %v", name, err)
|
t.Fatalf("failed to get apps/v1 deployment %s: %v", name, err)
|
||||||
}
|
}
|
||||||
newSelectorLabels = map[string]string{"name_apps_v1": "test_apps_v1"}
|
newSelectorLabels := map[string]string{"name_apps_v1": "test_apps_v1"}
|
||||||
deploymentAppsV1.Spec.Selector.MatchLabels = newSelectorLabels
|
deploymentAppsV1.Spec.Selector.MatchLabels = newSelectorLabels
|
||||||
deploymentAppsV1.Spec.Template.Labels = newSelectorLabels
|
deploymentAppsV1.Spec.Template.Labels = newSelectorLabels
|
||||||
_, err = c.AppsV1().Deployments(ns.Name).Update(context.TODO(), deploymentAppsV1, metav1.UpdateOptions{})
|
_, err = c.AppsV1().Deployments(ns.Name).Update(context.TODO(), deploymentAppsV1, metav1.UpdateOptions{})
|
||||||
|
Loading…
Reference in New Issue
Block a user