Skip to content

Commit 908ac8d

Browse files
author
Franck Rupin
committed
Fix PR's comments
- This commit fixes ambiguity for some comments - It improves error variable names - It fixes english idioms
1 parent 44b927a commit 908ac8d

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

ovs/datapath.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ import (
2222
)
2323

2424
var (
25-
errMissingDataPathName = errors.New("datapath name argument is mandatory")
26-
errUninitializedClient = errors.New("client unitialized")
27-
errMissingMandatoryZone = errors.New("at least 1 zone is mandatory")
28-
errWrongArgumentNumber = errors.New("missing or too much arguments to setup ct limits")
29-
errWrongDefaultArgument = errors.New("wrong argument while setting default ct limits")
30-
errWrongZoneArgument = errors.New("wrong argument while setting zone ct limits")
25+
errMissingMandatoryDataPathName = errors.New("datapath name argument is mandatory")
26+
errUninitializedClient = errors.New("client unitialized")
27+
errMissingMandatoryZone = errors.New("at least 1 zone is mandatory")
28+
errWrongArgumentNumber = errors.New("missing or too many arguments to setup ct limits")
29+
errWrongDefaultArgument = errors.New("wrong argument while setting default ct limits")
30+
errWrongZoneArgument = errors.New("wrong argument while setting zone ct limits")
3131
)
3232

3333
// Zone defines the type used to store a zone as it is returned
@@ -44,7 +44,7 @@ type Zone map[string]uint64
4444
type ConnTrackOutput struct {
4545
// defaulCT is used to store the global setting: default
4646
defaultLimit Zone
47-
//zones stores all remaning zone's settings
47+
// zones stores all remaning zone's settings
4848
zones []Zone
4949
}
5050

@@ -78,10 +78,10 @@ type ConnTrackReader interface {
7878
// ConnTrackWriter is the interface defining the write operations
7979
// of ovs conntrack
8080
type ConnTrackWriter interface {
81-
// SetCTLimits is the method used to setup a limit for an ofport (zone)
81+
// SetCTLimits is the method used to setup a limit for a zone
8282
// belonging to a datapath of a switch
8383
SetCTLimits(string) (string, error)
84-
// DelCTLimits is the method used to remove a limit to an ofport (zone)
84+
// DelCTLimits is the method used to remove a limit to a zone
8585
// belonging to a datapath of a switch
8686
DelCTLimits(string, []uint64) (string, error)
8787
}
@@ -152,7 +152,7 @@ func (dp *DataPathService) DelDataPath(dpName string) error {
152152
func (dp *DataPathService) GetCTLimits(dpName string, zones []uint64) (*ConnTrackOutput, error) {
153153
// Start by building the args
154154
if dpName == "" {
155-
return nil, errMissingDataPathName
155+
return nil, errMissingMandatoryDataPathName
156156
}
157157

158158
args := []string{"ct-get-limits", dpName}
@@ -215,7 +215,7 @@ func (dp *DataPathService) GetCTLimits(dpName string, zones []uint64) (*ConnTrac
215215
func (dp *DataPathService) SetCTLimits(dpName string, zone map[string]uint64) (string, error) {
216216
// Sanitize the input
217217
if dpName == "" {
218-
return "", errMissingDataPathName
218+
return "", errMissingMandatoryDataPathName
219219
}
220220
argsStr, err := ctSetLimitsArgsToString(zone)
221221
if err != nil {
@@ -233,7 +233,7 @@ func (dp *DataPathService) SetCTLimits(dpName string, zone map[string]uint64) (s
233233
// sudo ovs-dpctl ct-del-limits system@ovs-system zone=40,4
234234
func (dp *DataPathService) DelCTLimits(dpName string, zones []uint64) (string, error) {
235235
if dpName == "" {
236-
return "", errMissingDataPathName
236+
return "", errMissingMandatoryDataPathName
237237
}
238238
if len(zones) < 1 {
239239
return "", errMissingMandatoryZone
@@ -253,7 +253,7 @@ func (dp *DataPathService) DelCTLimits(dpName string, zones []uint64) (string, e
253253
return string(results), err
254254
}
255255

256-
// ctSetLimitsArgsToString is function to help formating and sanatizing an input
256+
// ctSetLimitsArgsToString helps formating and sanatizing an input
257257
// It takes a map and output a string like this:
258258
// - "zone=2,limit=10000" or "limit=10000,zone=2"
259259
// - "default=10000"

ovs/datapath_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ func TestCtSetLimitsArgsToString(t *testing.T) {
409409
zone: invalidZone,
410410
want1: "",
411411
want2: "",
412-
err: "missing or too much arguments to setup ct limits",
412+
err: "missing or too many arguments to setup ct limits",
413413
},
414414
{
415415
desc: "Test parse missing limit argument",
@@ -430,7 +430,7 @@ func TestCtSetLimitsArgsToString(t *testing.T) {
430430
zone: make(map[string]uint64),
431431
want1: "",
432432
want2: "",
433-
err: "missing or too much arguments to setup ct limits",
433+
err: "missing or too many arguments to setup ct limits",
434434
},
435435
}
436436
for _, tt := range tests {

0 commit comments

Comments
 (0)