Merge pull request #855 from mmorel-35/linters

enable durationcheck,  predeclared, unconvert, unused and wastedassign linters
This commit is contained in:
Dan Williams
2023-03-27 10:53:34 -05:00
committed by GitHub
9 changed files with 39 additions and 34 deletions

View File

@ -295,9 +295,9 @@ func cmdCheck(args *skel.CmdArgs) error {
if bandwidth.IngressRate > 0 && bandwidth.IngressBurst > 0 {
rateInBytes := bandwidth.IngressRate / 8
burstInBytes := bandwidth.IngressBurst / 8
bufferInBytes := buffer(uint64(rateInBytes), uint32(burstInBytes))
bufferInBytes := buffer(rateInBytes, uint32(burstInBytes))
latency := latencyInUsec(latencyInMillis)
limitInBytes := limit(uint64(rateInBytes), latency, uint32(burstInBytes))
limitInBytes := limit(rateInBytes, latency, uint32(burstInBytes))
qdiscs, err := SafeQdiscList(link)
if err != nil {
@ -312,13 +312,13 @@ func cmdCheck(args *skel.CmdArgs) error {
if !isTbf {
break
}
if tbf.Rate != uint64(rateInBytes) {
if tbf.Rate != rateInBytes {
return fmt.Errorf("Rate doesn't match")
}
if tbf.Limit != uint32(limitInBytes) {
if tbf.Limit != limitInBytes {
return fmt.Errorf("Limit doesn't match")
}
if tbf.Buffer != uint32(bufferInBytes) {
if tbf.Buffer != bufferInBytes {
return fmt.Errorf("Buffer doesn't match")
}
}
@ -327,9 +327,9 @@ func cmdCheck(args *skel.CmdArgs) error {
if bandwidth.EgressRate > 0 && bandwidth.EgressBurst > 0 {
rateInBytes := bandwidth.EgressRate / 8
burstInBytes := bandwidth.EgressBurst / 8
bufferInBytes := buffer(uint64(rateInBytes), uint32(burstInBytes))
bufferInBytes := buffer(rateInBytes, uint32(burstInBytes))
latency := latencyInUsec(latencyInMillis)
limitInBytes := limit(uint64(rateInBytes), latency, uint32(burstInBytes))
limitInBytes := limit(rateInBytes, latency, uint32(burstInBytes))
ifbDeviceName := getIfbDeviceName(bwConf.Name, args.ContainerID)
@ -351,13 +351,13 @@ func cmdCheck(args *skel.CmdArgs) error {
if !isTbf {
break
}
if tbf.Rate != uint64(rateInBytes) {
if tbf.Rate != rateInBytes {
return fmt.Errorf("Rate doesn't match")
}
if tbf.Limit != uint32(limitInBytes) {
if tbf.Limit != limitInBytes {
return fmt.Errorf("Limit doesn't match")
}
if tbf.Buffer != uint32(bufferInBytes) {
if tbf.Buffer != bufferInBytes {
return fmt.Errorf("Buffer doesn't match")
}
}