Skip to content

Commit

Permalink
cleanup: enable revive(var-naming rule) checking
Browse files Browse the repository at this point in the history
Signed-off-by: jwcesign <jwcesign@gmail.com>
  • Loading branch information
jwcesign committed Jan 10, 2024
1 parent d10b6d8 commit 947a80e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ linters-settings:
- name: blank-imports
- name: indent-error-flow
- name: unreachable-code
- name: var-naming
staticcheck:
checks:
- all
Expand Down
8 changes: 4 additions & 4 deletions pkg/controllers/status/work_status_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,12 +910,12 @@ func TestWorkStatusController_buildStatusIdentifier(t *testing.T) {
Status: clusterv1alpha1.ClusterStatus{},
}
clusterObj, _ := helper.ToUnstructured(cluster)
clusterJson, _ := json.Marshal(clusterObj)
clusterJSON, _ := json.Marshal(clusterObj)

t.Run("normal case", func(t *testing.T) {
work.Spec.Workload.Manifests = []workv1alpha1.Manifest{
{
RawExtension: runtime.RawExtension{Raw: clusterJson},
RawExtension: runtime.RawExtension{Raw: clusterJSON},
},
}
idf, err := c.buildStatusIdentifier(work, clusterObj)
Expand All @@ -925,10 +925,10 @@ func TestWorkStatusController_buildStatusIdentifier(t *testing.T) {

t.Run("failed to GetManifestIndex", func(t *testing.T) {
wrongClusterObj, _ := helper.ToUnstructured(newCluster("cluster", clusterv1alpha1.ClusterConditionReady, metav1.ConditionTrue))
wrongClusterJson, _ := json.Marshal(wrongClusterObj)
wrongClusterJSON, _ := json.Marshal(wrongClusterObj)
work.Spec.Workload.Manifests = []workv1alpha1.Manifest{
{
RawExtension: runtime.RawExtension{Raw: wrongClusterJson},
RawExtension: runtime.RawExtension{Raw: wrongClusterJSON},
},
}
idf, err := c.buildStatusIdentifier(work, clusterObj)
Expand Down
6 changes: 3 additions & 3 deletions pkg/dependenciesdistributor/dependencies_distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ import (
)

const (
// bindingDependedIdLabelKey is the resource id of the independent binding which the attached binding depends on.
bindingDependedIdLabelKey = "resourcebinding.karmada.io/depended-id"
// bindingDependedIDLabelKey is the resource id of the independent binding which the attached binding depends on.
bindingDependedIDLabelKey = "resourcebinding.karmada.io/depended-id"

// 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.
Expand Down Expand Up @@ -658,7 +658,7 @@ func buildAttachedBinding(binding *workv1alpha2.ResourceBinding, object *unstruc
})

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{
ObjectMeta: metav1.ObjectMeta{
Name: names.GenerateBindingName(object.GetKind(), object.GetName()),
Expand Down
6 changes: 3 additions & 3 deletions pkg/util/proxy/upgrade_dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ func (u *UpgradeDialer) dial(req *http.Request) (net.Conn, error) {
case "socks5":
return u.dialWithSocks5Proxy(req, proxyURL)
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)
}

// 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) {
// 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) {
// ensure we use a canonical host with proxyReq
targetHost := netutil.CanonicalAddr(req.URL)

Expand Down

0 comments on commit 947a80e

Please sign in to comment.