linter fixes
This commit is contained in:
parent
4bf887e75f
commit
df5babf6c8
15 changed files with 49 additions and 55 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) + `}`
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue