nitpicks.

This commit is contained in:
Colin Henry 2020-10-23 21:55:48 -07:00
parent 07db4cf999
commit 8a1403a35d
3 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
package log package log
// Logger is a loggin interface with only the essentials that a function that needs to log should care about. Compatible with standard Go logger. // Logger is a logging interface with only the essentials that a function that needs to log should care about. Compatible with standard Go logger.
type Logger interface { type Logger interface {
Print(v ...interface{}) Print(v ...interface{})
Printf(format string, v ...interface{}) Printf(format string, v ...interface{})

View File

@ -20,7 +20,7 @@ func BasicAuth(h http.Handler, htpasswd map[string]string, realm string) http.Ha
user, pass, _ := r.BasicAuth() user, pass, _ := r.BasicAuth()
if pw, ok := htpasswd[user]; !ok || !strings.EqualFold(pass, sha1(pw)) { if pw, ok := htpasswd[user]; !ok || !strings.EqualFold(pass, sha1(pw)) {
w.Header().Set("WWW-Authenticate", rlm) w.Header().Set("WWW-Authenticate", rlm)
http.Error(w, "Unauthorized.", 401) http.Error(w, "Unauthorized", 401)
return return
} }
h.ServeHTTP(w, r) h.ServeHTTP(w, r)

View File

@ -11,7 +11,7 @@ type StatusHandler int
func (s StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (s StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
code := int(s) code := int(s)
w.WriteHeader(code) w.WriteHeader(code)
io.WriteString(w, http.StatusText(code)) _, _ = io.WriteString(w, http.StatusText(code))
} }
var ( var (