Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix increment-decrement lint error #77479

Merged
merged 2 commits into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/credentialprovider/keyring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func (d *testProvider) LazyProvide(image string) *DockerConfigEntry {

// Provide implements dockerConfigProvider
func (d *testProvider) Provide(image string) DockerConfig {
d.Count += 1
d.Count++
return DockerConfig{}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/registry/apps/replicaset/storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func TestGenerationNumber(t *testing.T) {
}

// 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 {
t.Errorf("unexpected error: %v", err)
}
Expand All @@ -187,7 +187,7 @@ func TestGenerationNumber(t *testing.T) {
}

// 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 {
t.Errorf("unexpected error: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func TestGenerationNumber(t *testing.T) {
}

// 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 {
t.Errorf("unexpected error: %v", err)
}
Expand All @@ -190,7 +190,7 @@ func TestGenerationNumber(t *testing.T) {
}

// 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 {
t.Errorf("unexpected error: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions staging/src/k8s.io/apimachinery/pkg/api/resource/math.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ func negativeScaleInt64(base int64, scale Scale) (result int64, exact bool) {
}
if fraction {
if base > 0 {
value += 1
value++
} else {
value += -1
value--
}
}
return value, !fraction
Expand Down
12 changes: 6 additions & 6 deletions staging/src/k8s.io/client-go/util/jsonpath/jsonpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) {

// encounter an end node, break the current block
if j.endRange > 0 && j.endRange <= j.inRange {
j.endRange -= 1
j.endRange--
break
}
// encounter a range node, start a range loop
if j.beginRange > 0 {
j.beginRange -= 1
j.inRange += 1
j.beginRange--
j.inRange++
for k, value := range results {
j.parser.Root.Nodes = nodes[i+1:]
if k == len(results)-1 {
j.inRange -= 1
j.inRange--
}
nextResults, err := j.FindResults(value.Interface())
if err != nil {
Expand Down Expand Up @@ -213,11 +213,11 @@ func (j *JSONPath) evalIdentifier(input []reflect.Value, node *IdentifierNode) (
switch node.Name {
case "range":
j.stack = append(j.stack, j.cur)
j.beginRange += 1
j.beginRange++
results = input
case "end":
if j.endRange < j.inRange { // inside a loop, break the current block
j.endRange += 1
j.endRange++
break
}
// the loop is about to end, pop value and continue the following execution
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/network/service_latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func runServiceLatencies(f *framework.Framework, inParallel, total int, acceptab
select {
case e := <-errs:
e2elog.Logf("Got error: %v", e)
errCount += 1
errCount++
case d := <-durations:
output = append(output, d)
}
Expand Down
4 changes: 2 additions & 2 deletions test/e2e_node/garbage_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func containerGCTest(f *framework.Framework, test testRun) {
containerCount := 0
for _, containerName := range containerNames {
if containerName == pod.getContainerName(i) {
containerCount += 1
containerCount++
}
}
if containerCount > maxPerPodContainer+1 {
Expand Down Expand Up @@ -228,7 +228,7 @@ func containerGCTest(f *framework.Framework, test testRun) {
containerCount := 0
for _, containerName := range containerNames {
if containerName == pod.getContainerName(i) {
containerCount += 1
containerCount++
}
}
if pod.restartCount > 0 && containerCount < maxPerPodContainer+1 {
Expand Down