Merge pull request #77479 from danielqsj/id

fix increment-decrement lint error
k3s-v1.15.3
Kubernetes Prow Robot 2019-05-07 22:14:45 -07:00 committed by GitHub
commit 11a46d2515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 16 deletions

View File

@ -470,7 +470,7 @@ func (d *testProvider) LazyProvide(image string) *DockerConfigEntry {
// Provide implements dockerConfigProvider // Provide implements dockerConfigProvider
func (d *testProvider) Provide(image string) DockerConfig { func (d *testProvider) Provide(image string) DockerConfig {
d.Count += 1 d.Count++
return DockerConfig{} return DockerConfig{}
} }

View File

@ -173,7 +173,7 @@ func TestGenerationNumber(t *testing.T) {
} }
// Updates to spec should increment the generation number // Updates to spec should increment the generation number
storedRS.Spec.Replicas += 1 storedRS.Spec.Replicas++
if _, _, err := storage.ReplicaSet.Update(ctx, storedRS.Name, rest.DefaultUpdatedObjectInfo(storedRS), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil { if _, _, err := storage.ReplicaSet.Update(ctx, storedRS.Name, rest.DefaultUpdatedObjectInfo(storedRS), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)
} }
@ -187,7 +187,7 @@ func TestGenerationNumber(t *testing.T) {
} }
// Updates to status should not increment either spec or status generation numbers // Updates to status should not increment either spec or status generation numbers
storedRS.Status.Replicas += 1 storedRS.Status.Replicas++
if _, _, err := storage.ReplicaSet.Update(ctx, storedRS.Name, rest.DefaultUpdatedObjectInfo(storedRS), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil { if _, _, err := storage.ReplicaSet.Update(ctx, storedRS.Name, rest.DefaultUpdatedObjectInfo(storedRS), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)
} }

View File

@ -176,7 +176,7 @@ func TestGenerationNumber(t *testing.T) {
} }
// Updates to spec should increment the generation number // Updates to spec should increment the generation number
controller.Spec.Replicas += 1 controller.Spec.Replicas++
if _, _, err := storage.Controller.Update(ctx, controller.Name, rest.DefaultUpdatedObjectInfo(controller), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil { if _, _, err := storage.Controller.Update(ctx, controller.Name, rest.DefaultUpdatedObjectInfo(controller), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)
} }
@ -190,7 +190,7 @@ func TestGenerationNumber(t *testing.T) {
} }
// Updates to status should not increment either spec or status generation numbers // Updates to status should not increment either spec or status generation numbers
controller.Status.Replicas += 1 controller.Status.Replicas++
if _, _, err := storage.Controller.Update(ctx, controller.Name, rest.DefaultUpdatedObjectInfo(controller), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil { if _, _, err := storage.Controller.Update(ctx, controller.Name, rest.DefaultUpdatedObjectInfo(controller), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{}); err != nil {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)
} }

View File

@ -194,9 +194,9 @@ func negativeScaleInt64(base int64, scale Scale) (result int64, exact bool) {
} }
if fraction { if fraction {
if base > 0 { if base > 0 {
value += 1 value++
} else { } else {
value += -1 value--
} }
} }
return value, !fraction return value, !fraction

View File

@ -93,17 +93,17 @@ func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) {
// encounter an end node, break the current block // encounter an end node, break the current block
if j.endRange > 0 && j.endRange <= j.inRange { if j.endRange > 0 && j.endRange <= j.inRange {
j.endRange -= 1 j.endRange--
break break
} }
// encounter a range node, start a range loop // encounter a range node, start a range loop
if j.beginRange > 0 { if j.beginRange > 0 {
j.beginRange -= 1 j.beginRange--
j.inRange += 1 j.inRange++
for k, value := range results { for k, value := range results {
j.parser.Root.Nodes = nodes[i+1:] j.parser.Root.Nodes = nodes[i+1:]
if k == len(results)-1 { if k == len(results)-1 {
j.inRange -= 1 j.inRange--
} }
nextResults, err := j.FindResults(value.Interface()) nextResults, err := j.FindResults(value.Interface())
if err != nil { if err != nil {
@ -213,11 +213,11 @@ func (j *JSONPath) evalIdentifier(input []reflect.Value, node *IdentifierNode) (
switch node.Name { switch node.Name {
case "range": case "range":
j.stack = append(j.stack, j.cur) j.stack = append(j.stack, j.cur)
j.beginRange += 1 j.beginRange++
results = input results = input
case "end": case "end":
if j.endRange < j.inRange { // inside a loop, break the current block if j.endRange < j.inRange { // inside a loop, break the current block
j.endRange += 1 j.endRange++
break break
} }
// the loop is about to end, pop value and continue the following execution // the loop is about to end, pop value and continue the following execution

View File

@ -177,7 +177,7 @@ func runServiceLatencies(f *framework.Framework, inParallel, total int, acceptab
select { select {
case e := <-errs: case e := <-errs:
e2elog.Logf("Got error: %v", e) e2elog.Logf("Got error: %v", e)
errCount += 1 errCount++
case d := <-durations: case d := <-durations:
output = append(output, d) output = append(output, d)
} }

View File

@ -200,7 +200,7 @@ func containerGCTest(f *framework.Framework, test testRun) {
containerCount := 0 containerCount := 0
for _, containerName := range containerNames { for _, containerName := range containerNames {
if containerName == pod.getContainerName(i) { if containerName == pod.getContainerName(i) {
containerCount += 1 containerCount++
} }
} }
if containerCount > maxPerPodContainer+1 { if containerCount > maxPerPodContainer+1 {
@ -228,7 +228,7 @@ func containerGCTest(f *framework.Framework, test testRun) {
containerCount := 0 containerCount := 0
for _, containerName := range containerNames { for _, containerName := range containerNames {
if containerName == pod.getContainerName(i) { if containerName == pod.getContainerName(i) {
containerCount += 1 containerCount++
} }
} }
if pod.restartCount > 0 && containerCount < maxPerPodContainer+1 { if pod.restartCount > 0 && containerCount < maxPerPodContainer+1 {