summaryrefslogtreecommitdiff
path: root/caddyconfig
diff options
context:
space:
mode:
authorMohammed Al Sahaf <msaa1990@gmail.com>2020-04-09 00:31:51 +0300
committerGitHub <noreply@github.com>2020-04-08 15:31:51 -0600
commit7dfd69cdc5966ae454e35cd6e976686131bfda8d (patch)
tree4d58832966c5136d5be3d9b3f63dcb07c30999d1 /caddyconfig
parent28fdf64dc510472ccd9e6d46eb149d19cd70919a (diff)
chore: make the linter happier (#3245)
* chore: make the linter happier * chore: remove reference to maligned linter in .golangci.yml
Diffstat (limited to 'caddyconfig')
-rw-r--r--caddyconfig/httpcaddyfile/addresses.go6
-rw-r--r--caddyconfig/httpcaddyfile/httptype.go4
-rw-r--r--caddyconfig/httpcaddyfile/tlsapp.go2
3 files changed, 6 insertions, 6 deletions
diff --git a/caddyconfig/httpcaddyfile/addresses.go b/caddyconfig/httpcaddyfile/addresses.go
index 6545585..e40f30c 100644
--- a/caddyconfig/httpcaddyfile/addresses.go
+++ b/caddyconfig/httpcaddyfile/addresses.go
@@ -138,7 +138,7 @@ func (st *ServerType) mapAddressToServerBlocks(originalServerBlocks []serverBloc
// association from multiple addresses to multiple server blocks; i.e. each element of
// the returned slice) becomes a server definition in the output JSON.
func (st *ServerType) consolidateAddrMappings(addrToServerBlocks map[string][]serverBlock) []sbAddrAssociation {
- var sbaddrs []sbAddrAssociation
+ sbaddrs := make([]sbAddrAssociation, 0, len(addrToServerBlocks))
for addr, sblocks := range addrToServerBlocks {
// we start with knowing that at least this address
// maps to these server blocks
@@ -199,7 +199,7 @@ func (st *ServerType) listenerAddrsForServerBlockKey(sblock serverBlock, key str
}
// the bind directive specifies hosts, but is optional
- var lnHosts []string
+ lnHosts := make([]string, 0, len(sblock.pile))
for _, cfgVal := range sblock.pile["bind"] {
lnHosts = append(lnHosts, cfgVal.Value.([]string)...)
}
@@ -219,7 +219,7 @@ func (st *ServerType) listenerAddrsForServerBlockKey(sblock serverBlock, key str
}
// now turn map into list
- var listenersList []string
+ listenersList := make([]string, 0, len(listeners))
for lnStr := range listeners {
listenersList = append(listenersList, lnStr)
}
diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go
index 4c5f445..b7d16d8 100644
--- a/caddyconfig/httpcaddyfile/httptype.go
+++ b/caddyconfig/httpcaddyfile/httptype.go
@@ -50,7 +50,7 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
// chosen to handle a request - we actually will make each
// server block's route terminal so that only one will run
sbKeys := make(map[string]struct{})
- var serverBlocks []serverBlock
+ serverBlocks := make([]serverBlock, 0, len(originalServerBlocks))
for i, sblock := range originalServerBlocks {
for j, k := range sblock.Keys {
if _, ok := sbKeys[k]; ok {
@@ -939,7 +939,7 @@ func (st *ServerType) compileEncodedMatcherSets(sblock serverBlock) ([]caddy.Mod
}
// finally, encode each of the matcher sets
- var matcherSetsEnc []caddy.ModuleMap
+ matcherSetsEnc := make([]caddy.ModuleMap, 0, len(matcherSets))
for _, ms := range matcherSets {
msEncoded, err := encodeMatcherSet(ms)
if err != nil {
diff --git a/caddyconfig/httpcaddyfile/tlsapp.go b/caddyconfig/httpcaddyfile/tlsapp.go
index b31bdc5..5c62233 100644
--- a/caddyconfig/httpcaddyfile/tlsapp.go
+++ b/caddyconfig/httpcaddyfile/tlsapp.go
@@ -246,7 +246,7 @@ func (st ServerType) buildTLSApp(
}
clVal := reflect.ValueOf(cl)
for i := 0; i < clVal.Len(); i++ {
- combined = reflect.Append(reflect.Value(combined), clVal.Index(i))
+ combined = reflect.Append(combined, clVal.Index(i))
}
loadersByName[name] = combined.Interface().(caddytls.CertificateLoader)
}