Skip to content

Commit e40c552

Browse files
imikushinknative-prow-robot
authored andcommitted
gofmt (knative#2069)
* gofmt * cleanup
1 parent 0cb7168 commit e40c552

File tree

14 files changed

+105
-108
lines changed

14 files changed

+105
-108
lines changed

pkg/activator/dedupe_test.go

+28-28
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestSingleRevision_SingleRequest_Success(t *testing.T) {
3030
want := Endpoint{"ip", 8080}
3131
f := newFakeActivator(t,
3232
map[revisionID]activationResult{
33-
revisionID{testNamespace, testConfiguration, testRevision}: activationResult{
33+
revisionID{testNamespace, testConfiguration, testRevision}: {
3434
endpoint: want,
3535
status: Status(0),
3636
err: nil,
@@ -58,7 +58,7 @@ func TestSingleRevision_MultipleRequests_Success(t *testing.T) {
5858
ep := Endpoint{"ip", 8080}
5959
f := newFakeActivator(t,
6060
map[revisionID]activationResult{
61-
revisionID{testNamespace, testConfiguration, testRevision}: activationResult{
61+
revisionID{testNamespace, testConfiguration, testRevision}: {
6262
endpoint: ep,
6363
status: Status(0),
6464
err: nil,
@@ -67,13 +67,13 @@ func TestSingleRevision_MultipleRequests_Success(t *testing.T) {
6767
d := NewDedupingActivator(f)
6868

6969
got := concurrentTest(d, f, []revisionID{
70-
revisionID{testNamespace, testConfiguration, testRevision},
71-
revisionID{testNamespace, testConfiguration, testRevision},
70+
{testNamespace, testConfiguration, testRevision},
71+
{testNamespace, testConfiguration, testRevision},
7272
})
7373

7474
want := []activationResult{
75-
activationResult{ep, Status(0), nil},
76-
activationResult{ep, Status(0), nil},
75+
{ep, Status(0), nil},
76+
{ep, Status(0), nil},
7777
}
7878
if !reflect.DeepEqual(want, got) {
7979
t.Errorf("Unexpected results. Wanted %+v. Got %+v.", want, got)
@@ -93,12 +93,12 @@ func TestMultipleRevisions_MultipleRequests_Success(t *testing.T) {
9393
ep2 := Endpoint{"ip2", 8080}
9494
f := newFakeActivator(t,
9595
map[revisionID]activationResult{
96-
revisionID{testNamespace, testConfiguration, "rev1"}: activationResult{
96+
revisionID{testNamespace, testConfiguration, "rev1"}: {
9797
endpoint: ep1,
9898
status: Status(0),
9999
err: nil,
100100
},
101-
revisionID{testNamespace, testConfiguration, "rev2"}: activationResult{
101+
revisionID{testNamespace, testConfiguration, "rev2"}: {
102102
endpoint: ep2,
103103
status: Status(0),
104104
err: nil,
@@ -107,17 +107,17 @@ func TestMultipleRevisions_MultipleRequests_Success(t *testing.T) {
107107
d := NewDedupingActivator(f)
108108

109109
got := concurrentTest(d, f, []revisionID{
110-
revisionID{testNamespace, testConfiguration, "rev1"},
111-
revisionID{testNamespace, testConfiguration, "rev2"},
112-
revisionID{testNamespace, testConfiguration, "rev1"},
113-
revisionID{testNamespace, testConfiguration, "rev2"},
110+
{testNamespace, testConfiguration, "rev1"},
111+
{testNamespace, testConfiguration, "rev2"},
112+
{testNamespace, testConfiguration, "rev1"},
113+
{testNamespace, testConfiguration, "rev2"},
114114
})
115115

116116
want := []activationResult{
117-
activationResult{ep1, Status(0), nil},
118-
activationResult{ep2, Status(0), nil},
119-
activationResult{ep1, Status(0), nil},
120-
activationResult{ep2, Status(0), nil},
117+
{ep1, Status(0), nil},
118+
{ep2, Status(0), nil},
119+
{ep1, Status(0), nil},
120+
{ep2, Status(0), nil},
121121
}
122122
if !reflect.DeepEqual(want, got) {
123123
t.Errorf("Unexpected results. \nWant %+v. \nGot %+v", want, got)
@@ -138,12 +138,12 @@ func TestMultipleRevisions_MultipleRequests_PartialSuccess(t *testing.T) {
138138
error2 := fmt.Errorf("test error")
139139
f := newFakeActivator(t,
140140
map[revisionID]activationResult{
141-
revisionID{testNamespace, testConfiguration, "rev1"}: activationResult{
141+
revisionID{testNamespace, testConfiguration, "rev1"}: {
142142
endpoint: ep1,
143143
status: Status(0),
144144
err: nil,
145145
},
146-
revisionID{testNamespace, testConfiguration, "rev2"}: activationResult{
146+
revisionID{testNamespace, testConfiguration, "rev2"}: {
147147
endpoint: Endpoint{},
148148
status: status2,
149149
err: error2,
@@ -152,17 +152,17 @@ func TestMultipleRevisions_MultipleRequests_PartialSuccess(t *testing.T) {
152152
d := NewDedupingActivator(f)
153153

154154
got := concurrentTest(d, f, []revisionID{
155-
revisionID{testNamespace, testConfiguration, "rev1"},
156-
revisionID{testNamespace, testConfiguration, "rev2"},
157-
revisionID{testNamespace, testConfiguration, "rev1"},
158-
revisionID{testNamespace, testConfiguration, "rev2"},
155+
{testNamespace, testConfiguration, "rev1"},
156+
{testNamespace, testConfiguration, "rev2"},
157+
{testNamespace, testConfiguration, "rev1"},
158+
{testNamespace, testConfiguration, "rev2"},
159159
})
160160

161161
want := []activationResult{
162-
activationResult{ep1, Status(0), nil},
163-
activationResult{Endpoint{}, status2, error2},
164-
activationResult{ep1, Status(0), nil},
165-
activationResult{Endpoint{}, status2, error2},
162+
{ep1, Status(0), nil},
163+
{Endpoint{}, status2, error2},
164+
{ep1, Status(0), nil},
165+
{Endpoint{}, status2, error2},
166166
}
167167
if !reflect.DeepEqual(want, got) {
168168
t.Errorf("Unexpected results. \nWant %+v. \nGot %+v", want, got)
@@ -182,7 +182,7 @@ func TestSingleRevision_MultipleRequests_FailureRecovery(t *testing.T) {
182182
failErr := fmt.Errorf("test error")
183183
f := newFakeActivator(t,
184184
map[revisionID]activationResult{
185-
revisionID{testNamespace, testConfiguration, testRevision}: activationResult{
185+
revisionID{testNamespace, testConfiguration, testRevision}: {
186186
endpoint: failEp,
187187
status: failStatus,
188188
err: failErr,
@@ -239,7 +239,7 @@ func TestShutdown_ReturnError(t *testing.T) {
239239
ep := Endpoint{"ip", 8080}
240240
f := newFakeActivator(t,
241241
map[revisionID]activationResult{
242-
revisionID{testNamespace, testConfiguration, testRevision}: activationResult{
242+
revisionID{testNamespace, testConfiguration, testRevision}: {
243243
endpoint: ep,
244244
status: Status(0),
245245
err: nil,

pkg/activator/handler/filtering_handler_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ func TestFilteringHandler(t *testing.T) {
2727
passed bool
2828
expectedStatus int
2929
}{{
30-
label: "forward a normal request",
31-
headers: http.Header{},
32-
passed: true,
33-
expectedStatus: http.StatusOK,
34-
},
30+
label: "forward a normal request",
31+
headers: http.Header{},
32+
passed: true,
33+
expectedStatus: http.StatusOK,
34+
},
3535
{
3636
label: "filter a request containing retry header",
3737
headers: http.Header{activator.ResponseCountHTTPHeader: {"4"}},

pkg/activator/handler/reporting_handler_test.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ import (
1919
"testing"
2020
"time"
2121

22-
"github.com/google/go-cmp/cmp/cmpopts"
23-
2422
"github.com/google/go-cmp/cmp"
25-
23+
"github.com/google/go-cmp/cmp/cmpopts"
2624
"github.com/knative/serving/pkg/activator"
27-
2825
)
2926

3027
func TestReporterHandlerResponseReceived(t *testing.T) {

pkg/autoscaler/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func NewConfigFromMap(data map[string]string) (*Config, error) {
7979
if raw, ok := data[b.key]; !ok {
8080
*b.field = false
8181
} else {
82-
*b.field = (strings.ToLower(raw) == "true")
82+
*b.field = strings.ToLower(raw) == "true"
8383
}
8484
}
8585

pkg/autoscaler/config_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ func TestNewConfig(t *testing.T) {
108108
"tick-interval": "2s",
109109
},
110110
want: &Config{
111-
EnableScaleToZero: true,
112-
EnableVPA: true,
111+
EnableScaleToZero: true,
112+
EnableVPA: true,
113113
ContainerConcurrencyTargetPercentage: 0.5,
114114
ContainerConcurrencyTargetDefault: 10.0,
115115
MaxScaleUpRate: 1.0,
@@ -136,8 +136,8 @@ func TestNewConfig(t *testing.T) {
136136
"tick-interval": "2s",
137137
},
138138
want: &Config{
139-
EnableScaleToZero: true,
140-
EnableVPA: true,
139+
EnableScaleToZero: true,
140+
EnableVPA: true,
141141
ContainerConcurrencyTargetPercentage: 0.5,
142142
ContainerConcurrencyTargetDefault: 10.0,
143143
MaxScaleUpRate: 1.0,

pkg/reconciler/names.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ func GetK8sServiceFullname(name string, namespace string) string {
2424

2525
func GetServingK8SServiceNameForObj(name string) string {
2626
return name + "-service"
27-
}
27+
}

pkg/reconciler/v1alpha1/revision/config/observability.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type Observability struct {
5252
func NewObservabilityFromConfigMap(configMap *corev1.ConfigMap) (*Observability, error) {
5353
oc := &Observability{}
5454
if evlc, ok := configMap.Data["logging.enable-var-log-collection"]; ok {
55-
oc.EnableVarLogCollection = (strings.ToLower(evlc) == "true")
55+
oc.EnableVarLogCollection = strings.ToLower(evlc) == "true"
5656
}
5757
if fsi, ok := configMap.Data["logging.fluentd-sidecar-image"]; ok {
5858
oc.FluentdSidecarImage = fsi

pkg/reconciler/v1alpha1/revision/resources/constants.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ const (
3636
userPortEnvName = "PORT"
3737

3838
// TODO(mattmoor): Make this private once we remove revision_test.go
39-
AutoscalerPort = 8080
39+
AutoscalerPort = 8080
4040

4141
// ServicePortName is the name of the external port of the service
42-
ServicePortName = "http"
42+
ServicePortName = "http"
4343
// ServicePort is the external port of the service
44-
ServicePort = int32(80)
45-
AppLabelKey = "app"
44+
ServicePort = int32(80)
45+
AppLabelKey = "app"
4646
)
4747

4848
var ProgressDeadlineSeconds int32 = 120

pkg/reconciler/v1alpha1/revision/resources/deploy_test.go

+21-21
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ func TestMakePodSpec(t *testing.T) {
7878
VolumeMounts: []corev1.VolumeMount{varLogVolumeMount},
7979
Lifecycle: userLifecycle,
8080
Env: []corev1.EnvVar{userEnv,
81-
corev1.EnvVar{
81+
{
8282
Name: "K_REVISION",
8383
Value: "bar",
84-
}, corev1.EnvVar{
84+
}, {
8585
Name: "K_CONFIGURATION",
8686
Value: "cfg",
87-
}, corev1.EnvVar{
87+
}, {
8888
Name: "K_SERVICE",
8989
Value: "svc",
9090
}},
@@ -162,13 +162,13 @@ func TestMakePodSpec(t *testing.T) {
162162
VolumeMounts: []corev1.VolumeMount{varLogVolumeMount},
163163
Lifecycle: userLifecycle,
164164
Env: []corev1.EnvVar{userEnv,
165-
corev1.EnvVar{
165+
{
166166
Name: "K_REVISION",
167167
Value: "bar",
168-
}, corev1.EnvVar{
168+
}, {
169169
Name: "K_CONFIGURATION",
170170
Value: "cfg",
171-
}, corev1.EnvVar{
171+
}, {
172172
Name: "K_SERVICE",
173173
Value: "svc",
174174
}},
@@ -255,13 +255,13 @@ func TestMakePodSpec(t *testing.T) {
255255
VolumeMounts: []corev1.VolumeMount{varLogVolumeMount},
256256
Lifecycle: userLifecycle,
257257
Env: []corev1.EnvVar{userEnv,
258-
corev1.EnvVar{
258+
{
259259
Name: "K_REVISION",
260260
Value: "bar",
261-
}, corev1.EnvVar{
261+
}, {
262262
Name: "K_CONFIGURATION",
263263
Value: "cfg",
264-
}, corev1.EnvVar{
264+
}, {
265265
Name: "K_SERVICE",
266266
Value: "svc",
267267
}},
@@ -346,13 +346,13 @@ func TestMakePodSpec(t *testing.T) {
346346
VolumeMounts: []corev1.VolumeMount{varLogVolumeMount},
347347
Lifecycle: userLifecycle,
348348
Env: []corev1.EnvVar{userEnv,
349-
corev1.EnvVar{
349+
{
350350
Name: "K_REVISION",
351351
Value: "bar",
352-
}, corev1.EnvVar{
352+
}, {
353353
Name: "K_CONFIGURATION",
354354
Value: "cfg",
355-
}, corev1.EnvVar{
355+
}, {
356356
Name: "K_SERVICE",
357357
Value: "svc",
358358
}},
@@ -439,13 +439,13 @@ func TestMakePodSpec(t *testing.T) {
439439
VolumeMounts: []corev1.VolumeMount{varLogVolumeMount},
440440
Lifecycle: userLifecycle,
441441
Env: []corev1.EnvVar{userEnv,
442-
corev1.EnvVar{
442+
{
443443
Name: "K_REVISION",
444444
Value: "bar",
445-
}, corev1.EnvVar{
445+
}, {
446446
Name: "K_CONFIGURATION",
447447
Value: "cfg",
448-
}, corev1.EnvVar{
448+
}, {
449449
Name: "K_SERVICE",
450450
Value: "svc",
451451
}},
@@ -528,13 +528,13 @@ func TestMakePodSpec(t *testing.T) {
528528
VolumeMounts: []corev1.VolumeMount{varLogVolumeMount},
529529
Lifecycle: userLifecycle,
530530
Env: []corev1.EnvVar{userEnv,
531-
corev1.EnvVar{
531+
{
532532
Name: "K_REVISION",
533533
Value: "bar",
534-
}, corev1.EnvVar{
534+
}, {
535535
Name: "K_CONFIGURATION",
536536
Value: "cfg",
537-
}, corev1.EnvVar{
537+
}, {
538538
Name: "K_SERVICE",
539539
Value: "svc",
540540
}},
@@ -608,13 +608,13 @@ func TestMakePodSpec(t *testing.T) {
608608
VolumeMounts: []corev1.VolumeMount{varLogVolumeMount},
609609
Lifecycle: userLifecycle,
610610
Env: []corev1.EnvVar{userEnv,
611-
corev1.EnvVar{
611+
{
612612
Name: "K_REVISION",
613613
Value: "bar",
614-
}, corev1.EnvVar{
614+
}, {
615615
Name: "K_CONFIGURATION",
616616
Value: "cfg",
617-
}, corev1.EnvVar{
617+
}, {
618618
Name: "K_SERVICE",
619619
Value: "svc",
620620
}},

pkg/reconciler/v1alpha1/route/table_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1099,9 +1099,9 @@ func TestReconcile(t *testing.T) {
10991099
resources.MakeK8sService(simpleRunLatest("default", "pinned-becomes-ready", "config", nil)),
11001100
},
11011101
WantPatches: []clientgotesting.PatchActionImpl{
1102-
// TODO(#1495): The parent configuration isn't labeled because it's established through
1103-
// labels instead of owner references.
1104-
//patchAddLabel("default", "config", "serving.knative.dev/route", "pinned-becomes-ready"),
1102+
// TODO(#1495): The parent configuration isn't labeled because it's established through
1103+
// labels instead of owner references.
1104+
//patchAddLabel("default", "config", "serving.knative.dev/route", "pinned-becomes-ready"),
11051105
},
11061106
WantUpdates: []clientgotesting.UpdateActionImpl{{
11071107
Object: simplePinned("default", "pinned-becomes-ready",

test/cleanup.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func CleanupOnInterrupt(cleanup func(), logger *logging.BaseLogger) {
3131
c := make(chan os.Signal, 1)
3232
signal.Notify(c, os.Interrupt)
3333
go func() {
34-
for _ = range c {
34+
for range c {
3535
logger.Infof("Test interrupted, cleaning up.")
3636
cleanup()
3737
os.Exit(1)

test/conformance/route_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func createRouteAndConfig(logger *logging.BaseLogger, clients *test.Clients, nam
5151

5252
func updateConfigWithImage(clients *test.Clients, names test.ResourceNames, imagePaths []string) error {
5353
patches := []jsonpatch.JsonPatchOperation{
54-
jsonpatch.JsonPatchOperation{
54+
{
5555
Operation: "replace",
5656
Path: "/spec/revisionTemplate/spec/container/image",
5757
Value: imagePaths[1],

test/crd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func Route(namespace string, names ResourceNames) *v1alpha1.Route {
5656
},
5757
Spec: v1alpha1.RouteSpec{
5858
Traffic: []v1alpha1.TrafficTarget{
59-
v1alpha1.TrafficTarget{
59+
{
6060
Name: names.TrafficTarget,
6161
ConfigurationName: names.Config,
6262
Percent: 100,

0 commit comments

Comments
 (0)