Commit aedf4cd7 authored by Geoff Simmons's avatar Geoff Simmons

Simplifications from gofmt -s

Type declarations in struct literals are unnecessary where the type
is unambiguous.
parent a713f611
......@@ -52,7 +52,7 @@ var ing1 = &extensions.Ingress{
ServiceName: "default-svc2",
},
Rules: []extensions.IngressRule{
extensions.IngressRule{Host: "host1"},
{Host: "host1"},
},
},
}
......@@ -67,7 +67,7 @@ var ing2 = &extensions.Ingress{
ServiceName: "default-svc2",
},
Rules: []extensions.IngressRule{
extensions.IngressRule{Host: "host2"},
{Host: "host2"},
},
},
}
......@@ -79,8 +79,8 @@ var ing3 = &extensions.Ingress{
},
Spec: extensions.IngressSpec{
Rules: []extensions.IngressRule{
extensions.IngressRule{Host: "host1"},
extensions.IngressRule{Host: "host2"},
{Host: "host1"},
{Host: "host2"},
},
},
}
......@@ -213,9 +213,9 @@ var reqDispHarness = []struct {
exp vcl.Spec
}{{
spec: []vcr_v1alpha1.RequestDispSpec{
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.method",
Compare: vcr_v1alpha1.Equal,
Values: []string{"PRI"},
......@@ -226,17 +226,17 @@ var reqDispHarness = []struct {
Status: &status405,
},
},
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.http.Host",
Compare: vcr_v1alpha1.NotExists,
},
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.esi_level",
Count: &zero,
},
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.proto",
Compare: vcr_v1alpha1.Prefix,
Values: []string{"HTTP/1.1"},
......@@ -250,9 +250,9 @@ var reqDispHarness = []struct {
Status: &status400,
},
},
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.method",
Compare: vcr_v1alpha1.NotEqual,
Values: []string{
......@@ -271,9 +271,9 @@ var reqDispHarness = []struct {
Action: vcr_v1alpha1.RecvPipe,
},
},
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.method",
Compare: vcr_v1alpha1.NotEqual,
Values: []string{
......@@ -286,9 +286,9 @@ var reqDispHarness = []struct {
Action: vcr_v1alpha1.RecvPass,
},
},
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.http.Cookie",
Compare: vcr_v1alpha1.Exists,
},
......@@ -297,9 +297,9 @@ var reqDispHarness = []struct {
Action: vcr_v1alpha1.RecvPass,
},
},
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.http.Authorization",
Compare: vcr_v1alpha1.Exists,
},
......@@ -311,9 +311,9 @@ var reqDispHarness = []struct {
},
exp: vcl.Spec{
Dispositions: []vcl.DispositionSpec{
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.method",
Compare: vcl.Equal,
Values: []string{"PRI"},
......@@ -327,9 +327,9 @@ var reqDispHarness = []struct {
Status: uint16(405),
},
},
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.http.Host",
Compare: vcl.Exists,
Negate: true,
......@@ -337,7 +337,7 @@ var reqDispHarness = []struct {
CaseSensitive: true,
},
},
vcl.Condition{
{
Comparand: "req.esi_level",
Compare: vcl.Equal,
Count: &uintZero,
......@@ -345,7 +345,7 @@ var reqDispHarness = []struct {
CaseSensitive: true,
},
},
vcl.Condition{
{
Comparand: "req.proto",
Compare: vcl.Prefix,
Values: []string{"HTTP/1.1"},
......@@ -356,9 +356,9 @@ var reqDispHarness = []struct {
Status: uint16(400),
},
},
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.method",
Compare: vcl.Equal,
Negate: true,
......@@ -381,9 +381,9 @@ var reqDispHarness = []struct {
Action: vcl.RecvPipe,
},
},
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.method",
Compare: vcl.Equal,
Negate: true,
......@@ -400,9 +400,9 @@ var reqDispHarness = []struct {
Action: vcl.RecvPass,
},
},
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.http.Cookie",
Compare: vcl.Exists,
MatchFlags: vcl.MatchFlagsType{
......@@ -414,9 +414,9 @@ var reqDispHarness = []struct {
Action: vcl.RecvPass,
},
},
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.http.Authorization",
Compare: vcl.Exists,
MatchFlags: vcl.MatchFlagsType{
......@@ -431,9 +431,9 @@ var reqDispHarness = []struct {
},
}},
{spec: []vcr_v1alpha1.RequestDispSpec{
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.method",
Compare: vcr_v1alpha1.Equal,
Values: []string{"CONNECT"},
......@@ -443,9 +443,9 @@ var reqDispHarness = []struct {
Action: vcr_v1alpha1.RecvPipe,
},
},
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.method",
Compare: vcr_v1alpha1.NotEqual,
Values: []string{
......@@ -467,9 +467,9 @@ var reqDispHarness = []struct {
},
}, exp: vcl.Spec{
Dispositions: []vcl.DispositionSpec{
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.method",
Compare: vcl.Equal,
Values: []string{"CONNECT"},
......@@ -482,9 +482,9 @@ var reqDispHarness = []struct {
Action: vcl.RecvPipe,
},
},
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.method",
Compare: vcl.Equal,
Negate: true,
......@@ -511,9 +511,9 @@ var reqDispHarness = []struct {
},
}},
{spec: []vcr_v1alpha1.RequestDispSpec{
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.url",
Compare: vcr_v1alpha1.Match,
Values: []string{
......@@ -528,9 +528,9 @@ var reqDispHarness = []struct {
Action: vcr_v1alpha1.RecvHash,
},
},
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.url",
Compare: vcr_v1alpha1.Prefix,
Values: []string{
......@@ -547,9 +547,9 @@ var reqDispHarness = []struct {
},
}, exp: vcl.Spec{
Dispositions: []vcl.DispositionSpec{
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.url",
Compare: vcl.Match,
Values: []string{
......@@ -567,9 +567,9 @@ var reqDispHarness = []struct {
Action: vcl.RecvHash,
},
},
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.url",
Compare: vcl.Prefix,
Values: []string{
......@@ -590,9 +590,9 @@ var reqDispHarness = []struct {
},
}},
{spec: []vcr_v1alpha1.RequestDispSpec{
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.method",
Compare: vcr_v1alpha1.Equal,
Values: []string{"PURGE"},
......@@ -604,9 +604,9 @@ var reqDispHarness = []struct {
},
}, exp: vcl.Spec{
Dispositions: []vcl.DispositionSpec{
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.method",
Compare: vcl.Equal,
Values: []string{"PURGE"},
......@@ -622,9 +622,9 @@ var reqDispHarness = []struct {
},
}},
{spec: []vcr_v1alpha1.RequestDispSpec{
vcr_v1alpha1.RequestDispSpec{
{
Conditions: []vcr_v1alpha1.ReqCondition{
vcr_v1alpha1.ReqCondition{
{
Comparand: "req.url",
Compare: vcr_v1alpha1.NotPrefix,
Values: []string{
......@@ -642,9 +642,9 @@ var reqDispHarness = []struct {
},
}, exp: vcl.Spec{
Dispositions: []vcl.DispositionSpec{
vcl.DispositionSpec{
{
Conditions: []vcl.Condition{
vcl.Condition{
{
Comparand: "req.url",
Compare: vcl.Prefix,
Negate: true,
......
......@@ -149,11 +149,11 @@ func (client *CrtDnldrClient) mkURL(spec SecretSpec) *url.URL {
var (
putSuccess = map[int]struct{}{
http.StatusCreated: struct{}{},
http.StatusNoContent: struct{}{},
http.StatusCreated: {},
http.StatusNoContent: {},
}
deleteSuccess = map[int]struct{}{
http.StatusNoContent: struct{}{},
http.StatusNoContent: {},
}
)
......
......@@ -187,7 +187,7 @@ var offldSite = &models.Site{
Name: frontend,
Service: &models.SiteService{
Listeners: []*models.Bind{
&models.Bind{
{
Name: frontend,
Port: &port,
Ssl: true,
......@@ -196,11 +196,11 @@ var offldSite = &models.Site{
},
},
Farms: []*models.SiteFarm{
&models.SiteFarm{
{
Name: backend,
UseAs: "default",
Servers: []*models.Server{
&models.Server{
{
Name: server,
Address: varnishSock,
Check: "enabled",
......
......@@ -163,17 +163,17 @@ var cafeSpecShuf = vcl.Spec{
}
var ingsMeta = map[string]Meta{
"default/cafe": Meta{
"default/cafe": {
Key: "default/cafe",
UID: "123e4567-e89b-12d3-a456-426655440000",
Ver: "123456",
},
"ns/name": Meta{
"ns/name": {
Key: "ns/name",
UID: "00112233-4455-6677-8899-aabbccddeeff",
Ver: "654321",
},
"kube-system/ingress": Meta{
"kube-system/ingress": {
Key: "kube-system/ingress",
UID: "6ba7b812-9dad-11d1-80b4-00c04fd430c8",
Ver: "987654",
......@@ -181,12 +181,12 @@ var ingsMeta = map[string]Meta{
}
var bcfgsMeta = map[string]Meta{
"coffee-svc": Meta{
"coffee-svc": {
Key: "default/coffee-svc-cfg",
UID: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
Ver: "010101",
},
"tea-svc": Meta{
"tea-svc": {
Key: "ns/tea-svc-cfg",
UID: "6ba7b811-9dad-11d1-80b4-00c04fd430c8",
Ver: "909090",
......@@ -200,11 +200,11 @@ var vcfgMeta = Meta{
}
var svcAddrs = []vcl.Address{
vcl.Address{
{
IP: "12.34.56.78",
Port: 6081,
},
vcl.Address{
{
IP: "87.65.43.21",
Port: 6081,
},
......@@ -250,11 +250,11 @@ func TestHasConfig(t *testing.T) {
}
testAddrs := []vcl.Address{
vcl.Address{
{
IP: "87.65.43.21",
Port: 6081,
},
vcl.Address{
{
IP: "12.34.56.78",
Port: 6081,
},
......@@ -267,11 +267,11 @@ func TestHasConfig(t *testing.T) {
}
testAddrs = []vcl.Address{
vcl.Address{
{
IP: "1.2.3.4",
Port: 6082,
},
vcl.Address{
{
IP: "8.7.6.5",
Port: 6082,
},
......@@ -283,7 +283,7 @@ func TestHasConfig(t *testing.T) {
}
testAddrs = []vcl.Address{
vcl.Address{
{
IP: "12.34.56.78",
Port: 6081,
},
......@@ -295,15 +295,15 @@ func TestHasConfig(t *testing.T) {
}
testAddrs = []vcl.Address{
vcl.Address{
{
IP: "12.34.56.78",
Port: 6081,
},
vcl.Address{
{
IP: "87.65.43.21",
Port: 6081,
},
vcl.Address{
{
IP: "47.11.08.15",
Port: 6081,
},
......
......@@ -35,15 +35,15 @@ import (
var varnishCluster = ShardCluster{
Nodes: []Service{
Service{
{
Name: "varnish-8445d4f7f-z2b9p",
Addresses: []Address{{"172.17.0.12", 80}},
},
Service{
{
Name: "varnish-8445d4f7f-k22dn",
Addresses: []Address{{"172.17.0.13", 80}},
},
Service{
{
Name: "varnish-8445d4f7f-ldljf",
Addresses: []Address{{"172.17.0.14", 80}},
},
......
......@@ -209,29 +209,29 @@ var acls = Spec{
FailStatus: 403,
Whitelist: true,
Addresses: []ACLAddress{
ACLAddress{
{
Addr: "localhost",
MaskBits: 255,
Negate: false,
},
ACLAddress{
{
Addr: "192.0.2.0",
MaskBits: 24,
Negate: false,
},
ACLAddress{
{
Addr: "192.0.2.23",
MaskBits: 255,
Negate: true,
},
},
Conditions: []MatchTerm{
MatchTerm{
{
Comparand: "req.http.Host",
Compare: Equal,
Value: "cafe.example.com",
},
MatchTerm{
{
Comparand: "req.url",
Compare: Match,
Value: `^/coffee(/|$)`,
......@@ -244,30 +244,30 @@ var acls = Spec{
FailStatus: 404,
Whitelist: false,
Addresses: []ACLAddress{
ACLAddress{
{
Addr: "192.168.100.14",
MaskBits: 24,
Negate: false,
},
ACLAddress{
{
Addr: "192.168.100.0",
MaskBits: 22,
Negate: false,
},
ACLAddress{
{
Addr: "2001:db8::",
MaskBits: 48,
Negate: false,
},
},
Conditions: []MatchTerm{
MatchTerm{
{
Comparand: "req.http.Host",
Compare: Equal,
Negate: true,
Value: "cafe.example.com",
},
MatchTerm{
{
Comparand: "req.url",
Compare: Match,
Negate: true,
......@@ -281,17 +281,17 @@ var acls = Spec{
FailStatus: 403,
Whitelist: true,
Addresses: []ACLAddress{
ACLAddress{
{
Addr: "10.0.0.0",
MaskBits: 24,
Negate: false,
},
ACLAddress{
{
Addr: "172.16.0.0",
MaskBits: 12,
Negate: false,
},
ACLAddress{
{
Addr: "192.168.0.0",
MaskBits: 16,
Negate: false,
......@@ -305,17 +305,17 @@ var acls = Spec{
FailStatus: 403,
Whitelist: true,
Addresses: []ACLAddress{
ACLAddress{
{
Addr: "192.0.2.0",
MaskBits: 24,
Negate: false,
},
ACLAddress{
{
Addr: "198.51.100.0",
MaskBits: 24,
Negate: false,
},
ACLAddress{
{
Addr: "203.0.113.0",
MaskBits: 24,
Negate: false,
......@@ -329,12 +329,12 @@ var acls = Spec{
FailStatus: 403,
Whitelist: true,
Addresses: []ACLAddress{
ACLAddress{
{
Addr: "127.0.0.0",
MaskBits: 8,
Negate: false,
},
ACLAddress{
{
Addr: "::1",
MaskBits: 255,
Negate: false,
......@@ -373,17 +373,17 @@ var aclResultHdr = Spec{
FailStatus: 403,
Whitelist: true,
Addresses: []ACLAddress{
ACLAddress{
{
Addr: "localhost",
MaskBits: 255,
Negate: false,
},
ACLAddress{
{
Addr: "192.0.2.0",
MaskBits: 24,
Negate: false,
},
ACLAddress{
{
Addr: "192.0.2.23",
MaskBits: 255,
Negate: true,
......@@ -424,17 +424,17 @@ var aclNoFail = Spec{
FailStatus: 0,
Whitelist: true,
Addresses: []ACLAddress{
ACLAddress{
{
Addr: "192.0.2.0",
MaskBits: 24,
Negate: false,
},
ACLAddress{
{
Addr: "198.51.100.0",
MaskBits: 24,
Negate: false,
},
ACLAddress{
{
Addr: "203.0.113.0",
MaskBits: 24,
Negate: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment