linter fixes

This commit is contained in:
ston1th 2021-11-07 13:30:22 +01:00
commit df5babf6c8
15 changed files with 49 additions and 55 deletions

View file

@ -1,11 +1,10 @@
package types
import (
"encoding/hex"
"git.giftfish.de/ston1th/haproxy-lb/pkg/config"
"golang.org/x/crypto/bcrypt"
weakrand "math/rand"
//"net/http"
"encoding/hex"
"strings"
"sync"
"time"
@ -28,11 +27,11 @@ func newCache() *cache {
}
}
func (c *cache) get(key string) (bool, bool) {
func (c *cache) get(key string) (v, ok bool) {
c.mtx.Lock()
defer c.mtx.Unlock()
v, ok := c.cache[key]
return v, ok
v, ok = c.cache[key]
return
}
func (c *cache) set(key string, value bool) {

View file

@ -8,6 +8,7 @@ import (
// Error interface is a custom api error
type Error interface {
Error() string
JSON() string
Status() int
}
@ -19,6 +20,11 @@ type Err struct {
// Error returns the error string
func (a Err) Error() string {
return a.err
}
// Error returns the error string as JSON format
func (a Err) JSON() string {
return `{"error":"` + a.err + `","status":` + strconv.Itoa(a.status) + `}`
}