Skip to content

Commit 5b19657

Browse files
committed
fixed golint
1 parent f88932c commit 5b19657

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

cns/middlewares/k8sSwiftV2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ func (k *K8sSWIFTv2Middleware) IPConfigsRequestHandlerWrapper(defaultHandler, fa
6666
var defaultDenyEngressPolicy, defaultDenyIngressPolicy policy.Policy
6767

6868
if defaultDenyACLbool && ipInfo.NICType == cns.InfraNIC {
69-
defaultDenyEngressPolicy, err = getEndpointPolicyL(string(policy.ACLPolicy), cns.ActionTypeBlock, cns.DirectionTypeOut, 10_000)
69+
defaultDenyEngressPolicy, err = getEndpointPolicy(string(policy.ACLPolicy), cns.ActionTypeBlock, cns.DirectionTypeOut, 10_000)
7070
if err != nil {
7171
logger.Errorf("failed to add default deny acl's for pod %v with err %v", podInfo.Name(), err)
7272
}
7373

74-
defaultDenyIngressPolicy, err = getEndpointPolicyL(string(policy.ACLPolicy), cns.ActionTypeBlock, cns.DirectionTypeIn, 10_000)
74+
defaultDenyIngressPolicy, err = getEndpointPolicy(string(policy.ACLPolicy), cns.ActionTypeBlock, cns.DirectionTypeIn, 10_000)
7575
if err != nil {
7676
logger.Errorf("failed to add default deny acl's for pod %v with err %v", podInfo.Name(), err)
7777
}

cns/middlewares/k8sSwiftV2_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@ func (k *K8sSWIFTv2Middleware) assignSubnetPrefixLengthFields(_ *cns.PodIpInfo,
105105

106106
func (k *K8sSWIFTv2Middleware) addDefaultRoute(*cns.PodIpInfo, string) {}
107107

108-
func getEndpointPolicyL(_, _, _ string, _ int) (policy.Policy, error) {
108+
func getEndpointPolicy(_, _, _ string, _ int) (policy.Policy, error) {
109109
return policy.Policy{}, nil
110110
}

cns/middlewares/k8sSwiftV2_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (k *K8sSWIFTv2Middleware) addDefaultRoute(podIPInfo *cns.PodIpInfo, gwIP st
6363
}
6464

6565
// get policy of type endpoint policy given the params
66-
func getEndpointPolicyL(policyType, action, direction string, priority int) (policy.Policy, error) {
66+
func getEndpointPolicy(policyType, action, direction string, priority int) (policy.Policy, error) {
6767
endpointPolicy, err := createEndpointPolicy(policyType, action, direction, priority)
6868
if err != nil {
6969
return policy.Policy{}, errors.Wrap(err, "failed to create endpoint policy")
@@ -78,7 +78,7 @@ func getEndpointPolicyL(policyType, action, direction string, priority int) (pol
7878
}
7979

8080
// create policy given the params
81-
func createEndpointPolicy(policyType string, action string, direction string, priority int) ([]byte, error) {
81+
func createEndpointPolicy(policyType, action, direction string, priority int) ([]byte, error) {
8282
type EndpointPolicy struct {
8383
Type string `json:"Type"`
8484
Action string `json:"Action"`

cns/middlewares/k8sSwiftV2_windows_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,14 @@ func TestAddDefaultDenyACL(t *testing.T) {
149149
var allEndpoints []policy.Policy
150150
var defaultDenyEngressPolicy, defaultDenyIngressPolicy policy.Policy
151151
var err error
152-
defaultDenyEngressPolicy, err = getEndpointPolicyL("ACL", "Block", "Out", 10000)
153-
defaultDenyIngressPolicy, err = getEndpointPolicyL("ACL", "Block", "In", 10000)
152+
defaultDenyEngressPolicy, err = getEndpointPolicy("ACL", "Block", "Out", 10_000)
153+
if err != nil {
154+
fmt.Printf("failed to create endpoint policy")
155+
}
156+
defaultDenyIngressPolicy, err = getEndpointPolicy("ACL", "Block", "In", 10_000)
157+
if err != nil {
158+
fmt.Printf("failed to create endpoint policy")
159+
}
154160

155161
allEndpoints = append(allEndpoints, defaultDenyEngressPolicy, defaultDenyIngressPolicy)
156162
assert.Equal(t, err, nil)

0 commit comments

Comments
 (0)