cleanup: enable revive(var-naming rule) checking
Signed-off-by: jwcesign <jwcesign@gmail.com>
This commit is contained in:
parent
d10b6d8000
commit
947a80e00f
|
@ -83,6 +83,7 @@ linters-settings:
|
||||||
- name: blank-imports
|
- name: blank-imports
|
||||||
- name: indent-error-flow
|
- name: indent-error-flow
|
||||||
- name: unreachable-code
|
- name: unreachable-code
|
||||||
|
- name: var-naming
|
||||||
staticcheck:
|
staticcheck:
|
||||||
checks:
|
checks:
|
||||||
- all
|
- all
|
||||||
|
|
|
@ -910,12 +910,12 @@ func TestWorkStatusController_buildStatusIdentifier(t *testing.T) {
|
||||||
Status: clusterv1alpha1.ClusterStatus{},
|
Status: clusterv1alpha1.ClusterStatus{},
|
||||||
}
|
}
|
||||||
clusterObj, _ := helper.ToUnstructured(cluster)
|
clusterObj, _ := helper.ToUnstructured(cluster)
|
||||||
clusterJson, _ := json.Marshal(clusterObj)
|
clusterJSON, _ := json.Marshal(clusterObj)
|
||||||
|
|
||||||
t.Run("normal case", func(t *testing.T) {
|
t.Run("normal case", func(t *testing.T) {
|
||||||
work.Spec.Workload.Manifests = []workv1alpha1.Manifest{
|
work.Spec.Workload.Manifests = []workv1alpha1.Manifest{
|
||||||
{
|
{
|
||||||
RawExtension: runtime.RawExtension{Raw: clusterJson},
|
RawExtension: runtime.RawExtension{Raw: clusterJSON},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
idf, err := c.buildStatusIdentifier(work, clusterObj)
|
idf, err := c.buildStatusIdentifier(work, clusterObj)
|
||||||
|
@ -925,10 +925,10 @@ func TestWorkStatusController_buildStatusIdentifier(t *testing.T) {
|
||||||
|
|
||||||
t.Run("failed to GetManifestIndex", func(t *testing.T) {
|
t.Run("failed to GetManifestIndex", func(t *testing.T) {
|
||||||
wrongClusterObj, _ := helper.ToUnstructured(newCluster("cluster", clusterv1alpha1.ClusterConditionReady, metav1.ConditionTrue))
|
wrongClusterObj, _ := helper.ToUnstructured(newCluster("cluster", clusterv1alpha1.ClusterConditionReady, metav1.ConditionTrue))
|
||||||
wrongClusterJson, _ := json.Marshal(wrongClusterObj)
|
wrongClusterJSON, _ := json.Marshal(wrongClusterObj)
|
||||||
work.Spec.Workload.Manifests = []workv1alpha1.Manifest{
|
work.Spec.Workload.Manifests = []workv1alpha1.Manifest{
|
||||||
{
|
{
|
||||||
RawExtension: runtime.RawExtension{Raw: wrongClusterJson},
|
RawExtension: runtime.RawExtension{Raw: wrongClusterJSON},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
idf, err := c.buildStatusIdentifier(work, clusterObj)
|
idf, err := c.buildStatusIdentifier(work, clusterObj)
|
||||||
|
|
|
@ -62,8 +62,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// bindingDependedIdLabelKey is the resource id of the independent binding which the attached binding depends on.
|
// bindingDependedIDLabelKey is the resource id of the independent binding which the attached binding depends on.
|
||||||
bindingDependedIdLabelKey = "resourcebinding.karmada.io/depended-id"
|
bindingDependedIDLabelKey = "resourcebinding.karmada.io/depended-id"
|
||||||
|
|
||||||
// bindingDependedByLabelKeyPrefix is the prefix to a label key specifying an attached binding referred by which independent binding.
|
// bindingDependedByLabelKeyPrefix is the prefix to a label key specifying an attached binding referred by which independent binding.
|
||||||
// the key is in the label of an attached binding which should be unique, because resource like secret can be referred by multiple deployments.
|
// the key is in the label of an attached binding which should be unique, because resource like secret can be referred by multiple deployments.
|
||||||
|
@ -658,7 +658,7 @@ func buildAttachedBinding(binding *workv1alpha2.ResourceBinding, object *unstruc
|
||||||
})
|
})
|
||||||
|
|
||||||
policyID := util.GetLabelValue(binding.Labels, workv1alpha2.ResourceBindingPermanentIDLabel)
|
policyID := util.GetLabelValue(binding.Labels, workv1alpha2.ResourceBindingPermanentIDLabel)
|
||||||
dependedLabels = util.DedupeAndMergeLabels(dependedLabels, map[string]string{bindingDependedIdLabelKey: policyID})
|
dependedLabels = util.DedupeAndMergeLabels(dependedLabels, map[string]string{bindingDependedIDLabelKey: policyID})
|
||||||
return &workv1alpha2.ResourceBinding{
|
return &workv1alpha2.ResourceBinding{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: names.GenerateBindingName(object.GetKind(), object.GetName()),
|
Name: names.GenerateBindingName(object.GetKind(), object.GetName()),
|
||||||
|
|
|
@ -120,14 +120,14 @@ func (u *UpgradeDialer) dial(req *http.Request) (net.Conn, error) {
|
||||||
case "socks5":
|
case "socks5":
|
||||||
return u.dialWithSocks5Proxy(req, proxyURL)
|
return u.dialWithSocks5Proxy(req, proxyURL)
|
||||||
case "https", "http", "":
|
case "https", "http", "":
|
||||||
return u.dialWithHttpProxy(req, proxyURL)
|
return u.dialWithHTTPProxy(req, proxyURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("proxy URL scheme not supported: %s", proxyURL.Scheme)
|
return nil, fmt.Errorf("proxy URL scheme not supported: %s", proxyURL.Scheme)
|
||||||
}
|
}
|
||||||
|
|
||||||
// dialWithHttpProxy dials the host specified by url through an http or an https proxy.
|
// dialWithHTTPProxy dials the host specified by url through an http or an https proxy.
|
||||||
func (u *UpgradeDialer) dialWithHttpProxy(req *http.Request, proxyURL *url.URL) (net.Conn, error) {
|
func (u *UpgradeDialer) dialWithHTTPProxy(req *http.Request, proxyURL *url.URL) (net.Conn, error) {
|
||||||
// ensure we use a canonical host with proxyReq
|
// ensure we use a canonical host with proxyReq
|
||||||
targetHost := netutil.CanonicalAddr(req.URL)
|
targetHost := netutil.CanonicalAddr(req.URL)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue