Using log.Panic instead

This commit is contained in:
Manu Mtz-Almeida
2015-03-23 05:50:10 +01:00
parent 34b1d0262e
commit 3e3ced70d4
6 changed files with 15 additions and 12 deletions

View File

@ -9,6 +9,7 @@ import (
"encoding/base64"
"errors"
"fmt"
"log"
"sort"
)
@ -60,12 +61,12 @@ func BasicAuth(accounts Accounts) HandlerFunc {
func processAccounts(accounts Accounts) authPairs {
if len(accounts) == 0 {
panic("Empty list of authorized credentials")
log.Panic("Empty list of authorized credentials")
}
pairs := make(authPairs, 0, len(accounts))
for user, password := range accounts {
if len(user) == 0 {
panic("User can not be empty")
log.Panic("User can not be empty")
}
base := user + ":" + password
value := "Basic " + base64.StdEncoding.EncodeToString([]byte(base))