* linter fixes

* Golint and format code

* fmt
This commit is contained in:
Miek Gieben
2017-02-22 07:25:58 +00:00
committed by GitHub
parent 81af74aad0
commit c5224b1048
14 changed files with 43 additions and 41 deletions

View File

@@ -59,22 +59,22 @@ func traceParse(c *caddy.Controller) (*Trace, error) {
if err != nil {
return tr, err
}
for c.NextBlock() {
switch c.Val() {
case "every":
args := c.RemainingArgs()
if len(args) != 1 {
return nil, c.ArgErr()
}
tr.every, err = strconv.ParseUint(args[0], 10, 64)
if err != nil {
return nil, err
}
for c.NextBlock() {
switch c.Val() {
case "every":
args := c.RemainingArgs()
if len(args) != 1 {
return nil, c.ArgErr()
}
tr.every, err = strconv.ParseUint(args[0], 10, 64)
if err != nil {
return nil, err
}
case "service":
args := c.RemainingArgs()
if len(args) != 1 {
return nil, c.ArgErr()
}
if len(args) != 1 {
return nil, c.ArgErr()
}
tr.serviceName = args[0]
case "client_server":
args := c.RemainingArgs()
@@ -102,12 +102,12 @@ func normalizeEndpoint(epType, ep string) (string, error) {
}
return ep, nil
default:
return "", fmt.Errorf("Tracing endpoint type '%s' is not supported.", epType)
return "", fmt.Errorf("tracing endpoint type '%s' is not supported", epType)
}
}
const (
defEP = "localhost:9411"
defEpType = "zipkin"
defEP = "localhost:9411"
defEpType = "zipkin"
defServiceName = "coredns"
)

View File

@@ -8,12 +8,12 @@ import (
func TestTraceParse(t *testing.T) {
tests := []struct {
input string
shouldErr bool
endpoint string
every uint64
serviceName string
clientServer bool
input string
shouldErr bool
endpoint string
every uint64
serviceName string
clientServer bool
}{
// oks
{`trace`, false, "http://localhost:9411/api/v1/spans", 1, `coredns`, false},

View File

@@ -21,10 +21,10 @@ type Trace struct {
Endpoint string
EndpointType string
Tracer ot.Tracer
serviceName string
clientServer bool
every uint64
count uint64
serviceName string
clientServer bool
every uint64
count uint64
Once sync.Once
}