summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/caddyauth/basicauth.go4
-rw-r--r--modules/caddyhttp/caddyauth/command.go2
-rw-r--r--modules/caddyhttp/fileserver/caddyfile.go2
-rw-r--r--modules/caddyhttp/replacer.go2
-rw-r--r--modules/caddyhttp/responsewriter.go4
-rw-r--r--modules/caddyhttp/routes.go2
-rw-r--r--modules/caddyhttp/templates/frontmatter.go2
-rw-r--r--modules/caddytls/automation.go2
-rw-r--r--modules/caddytls/fileloader.go2
-rw-r--r--modules/caddytls/pemloader.go2
-rw-r--r--modules/caddytls/tls.go2
11 files changed, 13 insertions, 13 deletions
diff --git a/modules/caddyhttp/caddyauth/basicauth.go b/modules/caddyhttp/caddyauth/basicauth.go
index b4cf838..d709f94 100644
--- a/modules/caddyhttp/caddyauth/basicauth.go
+++ b/modules/caddyhttp/caddyauth/basicauth.go
@@ -77,8 +77,8 @@ func (hba *HTTPBasicAuth) Provision(ctx caddy.Context) error {
}
acct.Username = repl.ReplaceAll(acct.Username, "")
- acct.Password = repl.ReplaceAll(string(acct.Password), "")
- acct.Salt = repl.ReplaceAll(string(acct.Salt), "")
+ acct.Password = repl.ReplaceAll(acct.Password, "")
+ acct.Salt = repl.ReplaceAll(acct.Salt, "")
if acct.Username == "" || acct.Password == "" {
return fmt.Errorf("account %d: username and password are required", i)
diff --git a/modules/caddyhttp/caddyauth/command.go b/modules/caddyhttp/caddyauth/command.go
index 70a11a0..24f6c5a 100644
--- a/modules/caddyhttp/caddyauth/command.go
+++ b/modules/caddyhttp/caddyauth/command.go
@@ -76,7 +76,7 @@ func cmdHashPassword(fs caddycmd.Flags) (int, error) {
return caddy.ExitCodeFailedStartup, err
}
- hashBase64 := base64.StdEncoding.EncodeToString([]byte(hash))
+ hashBase64 := base64.StdEncoding.EncodeToString(hash)
fmt.Println(hashBase64)
diff --git a/modules/caddyhttp/fileserver/caddyfile.go b/modules/caddyhttp/fileserver/caddyfile.go
index 2980436..9b458b2 100644
--- a/modules/caddyhttp/fileserver/caddyfile.go
+++ b/modules/caddyhttp/fileserver/caddyfile.go
@@ -146,7 +146,7 @@ func parseTryFiles(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error)
// if there are query strings in the list, we have to split into
// a separate route for each item with a query string, because
// the rewrite is different for that item
- var try []string
+ try := make([]string, 0, len(tryFiles))
for _, item := range tryFiles {
if idx := strings.Index(item, "?"); idx >= 0 {
if len(try) > 0 {
diff --git a/modules/caddyhttp/replacer.go b/modules/caddyhttp/replacer.go
index 51fe67f..b83977c 100644
--- a/modules/caddyhttp/replacer.go
+++ b/modules/caddyhttp/replacer.go
@@ -188,7 +188,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
if strings.HasPrefix(key, varsReplPrefix) {
varName := key[len(varsReplPrefix):]
tbl := req.Context().Value(VarsCtxKey).(map[string]interface{})
- raw, _ := tbl[varName]
+ raw := tbl[varName]
// variables can be dynamic, so always return true
// even when it may not be set; treat as empty then
return raw, true
diff --git a/modules/caddyhttp/responsewriter.go b/modules/caddyhttp/responsewriter.go
index a4ea1db..4338f6f 100644
--- a/modules/caddyhttp/responsewriter.go
+++ b/modules/caddyhttp/responsewriter.go
@@ -76,13 +76,13 @@ var ErrNotImplemented = fmt.Errorf("method not implemented")
type responseRecorder struct {
*ResponseWriterWrapper
- wroteHeader bool
statusCode int
buf *bytes.Buffer
shouldBuffer ShouldBufferFunc
- stream bool
size int
header http.Header
+ wroteHeader bool
+ stream bool
}
// NewResponseRecorder returns a new ResponseRecorder that can be
diff --git a/modules/caddyhttp/routes.go b/modules/caddyhttp/routes.go
index 1224e32..27d4922 100644
--- a/modules/caddyhttp/routes.go
+++ b/modules/caddyhttp/routes.go
@@ -167,7 +167,7 @@ func (routes RouteList) ProvisionHandlers(ctx caddy.Context) error {
// This should only be done once: after all the routes have
// been provisioned, and before serving requests.
func (routes RouteList) Compile(next Handler) Handler {
- var mid []Middleware
+ mid := make([]Middleware, 0, len(routes))
for _, route := range routes {
mid = append(mid, wrapRoute(route))
}
diff --git a/modules/caddyhttp/templates/frontmatter.go b/modules/caddyhttp/templates/frontmatter.go
index 730cfd1..d6b6d0e 100644
--- a/modules/caddyhttp/templates/frontmatter.go
+++ b/modules/caddyhttp/templates/frontmatter.go
@@ -33,7 +33,7 @@ func extractFrontMatter(input string) (map[string]interface{}, string, error) {
// see what kind of front matter there is, if any
var closingFence string
var fmParser func([]byte) (map[string]interface{}, error)
- switch string(firstLine) {
+ switch firstLine {
case yamlFrontMatterFenceOpen:
fmParser = yamlFrontMatter
closingFence = yamlFrontMatterFenceClose
diff --git a/modules/caddytls/automation.go b/modules/caddytls/automation.go
index 87e6b28..c623b82 100644
--- a/modules/caddytls/automation.go
+++ b/modules/caddytls/automation.go
@@ -150,7 +150,7 @@ func (ap *AutomationPolicy) Provision(tlsApp *TLS) error {
// none of the subjects qualify for a public certificate,
// set the issuer to internal so that these names can all
// get certificates; critically, we can only do this if an
- // issuer is not explictly configured (IssuerRaw, vs. just
+ // issuer is not explicitly configured (IssuerRaw, vs. just
// Issuer) AND if the list of subjects is non-empty
if ap.IssuerRaw == nil && len(ap.Subjects) > 0 {
var anyPublic bool
diff --git a/modules/caddytls/fileloader.go b/modules/caddytls/fileloader.go
index 6d6ff99..fdf5486 100644
--- a/modules/caddytls/fileloader.go
+++ b/modules/caddytls/fileloader.go
@@ -57,7 +57,7 @@ type CertKeyFilePair struct {
// LoadCertificates returns the certificates to be loaded by fl.
func (fl FileLoader) LoadCertificates() ([]Certificate, error) {
- var certs []Certificate
+ certs := make([]Certificate, 0, len(fl))
for _, pair := range fl {
certData, err := ioutil.ReadFile(pair.Certificate)
if err != nil {
diff --git a/modules/caddytls/pemloader.go b/modules/caddytls/pemloader.go
index 46d06a8..bd95781 100644
--- a/modules/caddytls/pemloader.go
+++ b/modules/caddytls/pemloader.go
@@ -54,7 +54,7 @@ type CertKeyPEMPair struct {
// LoadCertificates returns the certificates contained in pl.
func (pl PEMLoader) LoadCertificates() ([]Certificate, error) {
- var certs []Certificate
+ certs := make([]Certificate, 0, len(pl))
for i, pair := range pl {
cert, err := tls.X509KeyPair([]byte(pair.CertificatePEM), []byte(pair.KeyPEM))
if err != nil {
diff --git a/modules/caddytls/tls.go b/modules/caddytls/tls.go
index 1255d3d..ea80fa9 100644
--- a/modules/caddytls/tls.go
+++ b/modules/caddytls/tls.go
@@ -471,7 +471,7 @@ func (t *TLS) moveCertificates() error {
}
// get list of used CAs
- var oldCANames []string
+ oldCANames := make([]string, 0, len(oldAcmeCas))
for _, fi := range oldAcmeCas {
if !fi.IsDir() {
continue