Fix golint errors

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-02-02 15:24:11 +01:00
parent b11ce54ccc
commit ece54f1616
38 changed files with 134 additions and 204 deletions

View File

@@ -30,17 +30,6 @@ type (
SAML samlConfig `json:"saml"`
}
trustAuthConfig struct {
CookieName string `json:"cookie-name"`
CookieDomain string `json:"cookie-domain"`
CookieDuration int `json:"cookie-duration"`
TokenDuration int `json:"token-duration"`
ReportURLDuration int `json:"report-url-duration"`
TokenSecret string `json:"token-secret"`
Scope string `json:"scope"`
TokenType string `json:"token-type"`
}
cookieConfig struct {
Domain string `json:"domain"`
Secret string `json:"secret"`
@@ -92,22 +81,3 @@ func (c authConfig) GetCookieSecretBytes() ([]byte, error) {
return []byte(c.Cookie.Secret), nil
}
func (c trustAuthConfig) GetTokenSecretBytes() ([]byte, error) {
if c.TokenSecret == "" {
return nil, fmt.Errorf("token secret cannot be empty")
}
if decoded, err := base64.StdEncoding.DecodeString(c.TokenSecret); err == nil {
if len(decoded) < 32 {
return nil, fmt.Errorf("decoded token secret must be at least 32 bytes long")
}
return decoded, nil
}
if len(c.TokenSecret) < 32 {
return nil, fmt.Errorf("token secret must be at least 32 bytes long")
}
return []byte(c.TokenSecret), nil
}

View File

@@ -573,7 +573,7 @@ func (impl *Implm) runApiServer(
l.Info("using proxy protocol", log.Any("trusted-proxies", impl.cfg.Api.ProxyProtocol.TrustedProxies))
}
defer listener.Close()
defer func() { _ = listener.Close() }()
serverErrCh := make(chan error, 1)
go func() {
@@ -725,7 +725,7 @@ func (impl *Implm) runTrustCenterServer(
if err != nil {
return fmt.Errorf("cannot listen on %q: %w", httpServer.Addr, err)
}
defer listener.Close()
defer func() { _ = listener.Close() }()
if len(impl.cfg.TrustCenter.ProxyProtocol.TrustedProxies) > 0 {
policy := proxyproto.TrustProxyHeaderFrom(impl.cfg.TrustCenter.ProxyProtocol.TrustedProxies...)
@@ -807,7 +807,7 @@ func (impl *Implm) runTrustCenterServer(
if err != nil {
return fmt.Errorf("cannot listen on %q: %w", httpsServer.Addr, err)
}
defer listener.Close()
defer func() { _ = listener.Close() }()
if len(impl.cfg.TrustCenter.ProxyProtocol.TrustedProxies) > 0 {
policy := proxyproto.TrustProxyHeaderFrom(impl.cfg.TrustCenter.ProxyProtocol.TrustedProxies...)