Remove single-entry var blocks (#1589)

This commit is contained in:
田欧
2017-10-18 11:59:23 -05:00
committed by dfawley
parent 16c41925b8
commit faebfcb7bf
13 changed files with 49 additions and 80 deletions

View File

@ -50,9 +50,7 @@ const (
txtAttribute = "grpc_config="
)
var (
errMissingAddr = errors.New("missing address")
)
var errMissingAddr = errors.New("missing address")
// NewBuilder creates a dnsBuilder which is used to factory DNS resolvers.
func NewBuilder() resolver.Builder {

View File

@ -150,9 +150,8 @@ func div(b []byte) []string {
// resolver functionality, with scfs as the input and scs used for validation of
// the output. For scfs[3], it corresponds to empty service config, since there
// isn't a matched choice.
var (
scfs = []string{
`[
var scfs = []string{
`[
{
"clientLanguage": [
"CPP",
@ -242,7 +241,7 @@ var (
}
}
]`,
`[
`[
{
"clientLanguage": [
"CPP",
@ -335,7 +334,7 @@ var (
}
}
]`,
`[
`[
{
"clientLanguage": [
"CPP",
@ -434,7 +433,7 @@ var (
}
}
]`,
`[
`[
{
"clientLanguage": [
"CPP",
@ -489,13 +488,11 @@ var (
}
}
]`,
}
)
}
// scs contains an array of service config string in JSON format.
var (
scs = []string{
`{
var scs = []string{
`{
"methodConfig": [
{
"name": [
@ -508,7 +505,7 @@ var (
}
]
}`,
`{
`{
"methodConfig": [
{
"name": [
@ -524,7 +521,7 @@ var (
}
]
}`,
`{
`{
"loadBalancingPolicy": "round_robin",
"methodConfig": [
{
@ -546,8 +543,7 @@ var (
}
]
}`,
}
)
}
// scLookupTbl is a set, which contains targets that have service config. Target
// not in this set should not have service config.

View File

@ -27,9 +27,7 @@ import (
"golang.org/x/net/context"
)
var (
errForInvalidTarget = fmt.Errorf("invalid target address [2001:db8:a0b:12f0::1, error info: missing ']' in address [2001:db8:a0b:12f0::1:443")
)
var errForInvalidTarget = fmt.Errorf("invalid target address [2001:db8:a0b:12f0::1, error info: missing ']' in address [2001:db8:a0b:12f0::1:443")
func replaceNetFunc() func() {
oldLookupHost := lookupHost

View File

@ -26,9 +26,7 @@ import (
"net"
)
var (
errForInvalidTarget = fmt.Errorf("invalid target address [2001:db8:a0b:12f0::1, error info: address [2001:db8:a0b:12f0::1:443: missing ']' in address")
)
var errForInvalidTarget = fmt.Errorf("invalid target address [2001:db8:a0b:12f0::1, error info: address [2001:db8:a0b:12f0::1:443: missing ']' in address")
func replaceNetFunc() func() {
oldLookupHost := lookupHost