mirror of
https://github.com/caddyserver/caddy.git
synced 2026-08-03 22:33:28 +00:00
chore: make the linter happier (#3245)
* chore: make the linter happier * chore: remove reference to maligned linter in .golangci.yml
This commit is contained in:
parent
28fdf64dc5
commit
7dfd69cdc5
19 changed files with 28 additions and 26 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue