Skip to content

Commit a73b00c

Browse files
committed
Formatting [ci skip]
1 parent b2d657d commit a73b00c

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

actions/reconfigure.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (m *Reconfigure) reloadFromRegistry(addresses []string, instanceName, mode
134134
var data map[string]interface{}
135135
json.Unmarshal(body, &data)
136136
count = len(data)
137-
for key, _ := range data {
137+
for key := range data {
138138
go m.getService(addresses, key, instanceName, c)
139139
}
140140
logPrintf("\tFound %d services", count)

actions/reconfigure_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestReconfigureUnitTestSuite(t *testing.T) {
8383
case "/v1/catalog/services":
8484
w.WriteHeader(http.StatusOK)
8585
w.Header().Set("Content-Type", "application/json")
86-
data := map[string][]string{"service1": []string{}, "service2": []string{}, s.ServiceName: []string{}}
86+
data := map[string][]string{"service1": {}, "service2": {}, s.ServiceName: {}}
8787
js, _ := json.Marshal(data)
8888
w.Write(js)
8989
case fmt.Sprintf("/v1/kv/%s/%s/%s", s.InstanceName, s.ServiceName, registry.PATH_KEY):
@@ -375,9 +375,9 @@ backend myService-be1234
375375

376376
func (s ReconfigureTestSuite) Test_GetTemplates_AddsMultipleDestinations() {
377377
sd := []proxy.ServiceDest{
378-
proxy.ServiceDest{Port: "1111", ServicePath: []string{"path-1"}, SrcPort: 2222},
379-
proxy.ServiceDest{Port: "3333", ServicePath: []string{"path-2"}, SrcPort: 4444},
380-
proxy.ServiceDest{Port: "5555", ServicePath: []string{"path-3"}},
378+
{Port: "1111", ServicePath: []string{"path-1"}, SrcPort: 2222},
379+
{Port: "3333", ServicePath: []string{"path-2"}, SrcPort: 4444},
380+
{Port: "5555", ServicePath: []string{"path-3"}},
381381
}
382382
expectedBack := `
383383
backend myService-be1111

registry/consul.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ func (m Consul) PutService(addresses []string, instanceName string, r Registry)
3232
consulChannel := make(chan error)
3333
type data struct{ key, value string }
3434
d := []data{
35-
data{COLOR_KEY, r.ServiceColor},
36-
data{PATH_KEY, strings.Join(r.ServicePath, ",")},
37-
data{DOMAIN_KEY, strings.Join(r.ServiceDomain, ",")},
38-
data{HOSTNAME_KEY, r.OutboundHostname},
39-
data{PATH_TYPE_KEY, r.PathType},
40-
data{SKIP_CHECK_KEY, fmt.Sprintf("%t", r.SkipCheck)},
41-
data{CONSUL_TEMPLATE_FE_PATH_KEY, r.ConsulTemplateFePath},
42-
data{CONSUL_TEMPLATE_BE_PATH_KEY, r.ConsulTemplateBePath},
43-
data{PORT, r.Port},
35+
{COLOR_KEY, r.ServiceColor},
36+
{PATH_KEY, strings.Join(r.ServicePath, ",")},
37+
{DOMAIN_KEY, strings.Join(r.ServiceDomain, ",")},
38+
{HOSTNAME_KEY, r.OutboundHostname},
39+
{PATH_TYPE_KEY, r.PathType},
40+
{SKIP_CHECK_KEY, fmt.Sprintf("%t", r.SkipCheck)},
41+
{CONSUL_TEMPLATE_FE_PATH_KEY, r.ConsulTemplateFePath},
42+
{CONSUL_TEMPLATE_BE_PATH_KEY, r.ConsulTemplateBePath},
43+
{PORT, r.Port},
4444
}
4545
for _, e := range d {
4646
go m.SendPutRequest(addresses, r.ServiceName, e.key, e.value, instanceName, consulChannel)

registry/consul_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ func (s *ConsulTestSuite) Test_PutService_PutsDataToConsul() {
7878
type data struct{ key, value string }
7979

8080
d := []data{
81-
data{"color", s.registry.ServiceColor},
82-
data{"path", strings.Join(s.registry.ServicePath, ",")},
83-
data{"domain", strings.Join(s.registry.ServiceDomain, ",")},
84-
data{"hostname", s.registry.OutboundHostname},
85-
data{"pathtype", s.registry.PathType},
86-
data{"skipcheck", fmt.Sprintf("%t", s.registry.SkipCheck)},
87-
data{"consultemplatefepath", s.registry.ConsulTemplateFePath},
88-
data{"consultemplatebepath", s.registry.ConsulTemplateBePath},
89-
data{"port", string(s.registry.Port)},
81+
{"color", s.registry.ServiceColor},
82+
{"path", strings.Join(s.registry.ServicePath, ",")},
83+
{"domain", strings.Join(s.registry.ServiceDomain, ",")},
84+
{"hostname", s.registry.OutboundHostname},
85+
{"pathtype", s.registry.PathType},
86+
{"skipcheck", fmt.Sprintf("%t", s.registry.SkipCheck)},
87+
{"consultemplatefepath", s.registry.ConsulTemplateFePath},
88+
{"consultemplatebepath", s.registry.ConsulTemplateBePath},
89+
{"port", string(s.registry.Port)},
9090
}
9191
for _, e := range d {
9292
s.Contains(actualUrl, fmt.Sprintf("/v1/kv/%s/%s/%s", instanceName, s.registry.ServiceName, e.key))

server/server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ func (s *ServerTestSuite) Test_GetServiceFromUrl_ReturnsProxyService() {
618618
Distribute: true,
619619
SslVerifyNone: true,
620620
ServiceDomainMatchAll: true,
621-
ServiceDest: []proxy.ServiceDest{proxy.ServiceDest{ServicePath: []string{}}},
621+
ServiceDest: []proxy.ServiceDest{{ServicePath: []string{}}},
622622
}
623623
addr := fmt.Sprintf(
624624
"%s?serviceName=%s&aclName=%s&serviceColor=%s&serviceCert=%s&outboundHostname=%s&consulTemplateFePath=%s&consulTemplateBePath=%s&pathType=%s&reqPathSearch=%s&reqPathReplace=%s&templateFePath=%s&templateBePath=%s&timeoutServer=%s&timeoutTunnel=%s&reqMode=%s&httpsOnly=%t&xForwardedProto=%t&redirectWhenHttpProto=%t&httpsPort=%d&serviceDomain=%s&skipCheck=%t&distribute=%t&sslVerifyNone=%t&serviceDomainMatchAll=%t",

server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func (s *ServerTestSuite) Test_Execute_InvokesReconfigureExecuteForEachServiceDe
192192
server.NewServer = func(listenerAddr, mode, port, serviceName, configsPath, templatesPath string, consulAddresses []string, cert server.Certer) server.Server {
193193
return ServerMock{
194194
GetServicesFromEnvVarsMock: func() *[]proxy.Service {
195-
return &[]proxy.Service{proxy.Service{}, proxy.Service{}}
195+
return &[]proxy.Service{{}, {}}
196196
},
197197
}
198198
}

0 commit comments

Comments
 (0)