update lint rules and fix some warnings
This commit is contained in:
parent
18ab757216
commit
3e478f42ea
9 changed files with 34 additions and 2 deletions
|
@ -25,6 +25,14 @@ linters-settings:
|
|||
#enable:
|
||||
# - fieldalignment
|
||||
|
||||
issues:
|
||||
include:
|
||||
- EXC0002
|
||||
- EXC0012
|
||||
- EXC0013
|
||||
- EXC0014
|
||||
- EXC0015
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- goconst
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
// RetentionCheckNotification defines the supported notification methods for a retention check result
|
||||
type RetentionCheckNotification = string
|
||||
|
||||
// Supported notification methods
|
||||
const (
|
||||
// notify results using the defined "data_retention_hook"
|
||||
RetentionCheckNotificationHook = "Hook"
|
||||
|
|
|
@ -117,6 +117,7 @@ func (t *BaseTransfer) GetFsPath() string {
|
|||
return t.fsPath
|
||||
}
|
||||
|
||||
// SetTimes stores access and modification times if fsPath matches the current file
|
||||
func (t *BaseTransfer) SetTimes(fsPath string, atime time.Time, mtime time.Time) bool {
|
||||
if fsPath == t.GetFsPath() {
|
||||
t.aTime = atime
|
||||
|
|
|
@ -132,7 +132,8 @@ var (
|
|||
// ErrNoInitRequired defines the error returned by InitProvider if no inizialization/update is required
|
||||
ErrNoInitRequired = errors.New("the data provider is up to date")
|
||||
// ErrInvalidCredentials defines the error to return if the supplied credentials are invalid
|
||||
ErrInvalidCredentials = errors.New("invalid credentials")
|
||||
ErrInvalidCredentials = errors.New("invalid credentials")
|
||||
// ErrLoginNotAllowedFromIP defines the error to return if login is denied from the current IP
|
||||
ErrLoginNotAllowedFromIP = errors.New("login is not allowed from this IP")
|
||||
isAdminCreated = int32(0)
|
||||
validTLSUsernames = []string{string(sdk.TLSUsernameNone), string(sdk.TLSUsernameCN)}
|
||||
|
|
|
@ -10,34 +10,42 @@ type BaseSecret struct {
|
|||
Mode int `json:"mode,omitempty"`
|
||||
}
|
||||
|
||||
// GetStatus returns the secret's status
|
||||
func (s *BaseSecret) GetStatus() SecretStatus {
|
||||
return s.Status
|
||||
}
|
||||
|
||||
// GetPayload returns the secret's payload
|
||||
func (s *BaseSecret) GetPayload() string {
|
||||
return s.Payload
|
||||
}
|
||||
|
||||
// GetKey returns the secret's key
|
||||
func (s *BaseSecret) GetKey() string {
|
||||
return s.Key
|
||||
}
|
||||
|
||||
// GetMode returns the encryption mode
|
||||
func (s *BaseSecret) GetMode() int {
|
||||
return s.Mode
|
||||
}
|
||||
|
||||
// GetAdditionalData returns the secret's additional data
|
||||
func (s *BaseSecret) GetAdditionalData() string {
|
||||
return s.AdditionalData
|
||||
}
|
||||
|
||||
// SetKey sets the secret's key
|
||||
func (s *BaseSecret) SetKey(value string) {
|
||||
s.Key = value
|
||||
}
|
||||
|
||||
// SetAdditionalData sets the secret's additional data
|
||||
func (s *BaseSecret) SetAdditionalData(value string) {
|
||||
s.AdditionalData = value
|
||||
}
|
||||
|
||||
// SetStatus sets the secret's status
|
||||
func (s *BaseSecret) SetStatus(value SecretStatus) {
|
||||
s.Status = value
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ import (
|
|||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
// HCLogAdapter is an adapter for hclog.Logger
|
||||
type HCLogAdapter struct {
|
||||
hclog.Logger
|
||||
}
|
||||
|
||||
// Log emits a message and key/value pairs at a provided log level
|
||||
func (l *HCLogAdapter) Log(level hclog.Level, msg string, args ...interface{}) {
|
||||
var ev *zerolog.Event
|
||||
switch level {
|
||||
|
@ -29,38 +31,47 @@ func (l *HCLogAdapter) Log(level hclog.Level, msg string, args ...interface{}) {
|
|||
ev.Msg(msg)
|
||||
}
|
||||
|
||||
// Trace emits a message and key/value pairs at the TRACE level
|
||||
func (l *HCLogAdapter) Trace(msg string, args ...interface{}) {
|
||||
l.Log(hclog.Debug, msg, args...)
|
||||
}
|
||||
|
||||
// Debug emits a message and key/value pairs at the DEBUG level
|
||||
func (l *HCLogAdapter) Debug(msg string, args ...interface{}) {
|
||||
l.Log(hclog.Debug, msg, args...)
|
||||
}
|
||||
|
||||
// Info emits a message and key/value pairs at the INFO level
|
||||
func (l *HCLogAdapter) Info(msg string, args ...interface{}) {
|
||||
l.Log(hclog.Info, msg, args...)
|
||||
}
|
||||
|
||||
// Warn emits a message and key/value pairs at the WARN level
|
||||
func (l *HCLogAdapter) Warn(msg string, args ...interface{}) {
|
||||
l.Log(hclog.Warn, msg, args...)
|
||||
}
|
||||
|
||||
// Error emits a message and key/value pairs at the ERROR level
|
||||
func (l *HCLogAdapter) Error(msg string, args ...interface{}) {
|
||||
l.Log(hclog.Error, msg, args...)
|
||||
}
|
||||
|
||||
// With creates a sub-logger
|
||||
func (l *HCLogAdapter) With(args ...interface{}) hclog.Logger {
|
||||
return &HCLogAdapter{Logger: l.Logger.With(args...)}
|
||||
}
|
||||
|
||||
// Named creates a logger that will prepend the name string on the front of all messages
|
||||
func (l *HCLogAdapter) Named(name string) hclog.Logger {
|
||||
return &HCLogAdapter{Logger: l.Logger.Named(name)}
|
||||
}
|
||||
|
||||
// StandardLogger returns a value that conforms to the stdlib log.Logger interface
|
||||
func (l *HCLogAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger {
|
||||
return log.New(&StdLoggerWrapper{Sender: l.Name()}, "", 0)
|
||||
}
|
||||
|
||||
// StandardWriter returns a value that conforms to io.Writer, which can be passed into log.SetOutput()
|
||||
func (l *HCLogAdapter) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer {
|
||||
return &StdLoggerWrapper{Sender: l.Name()}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//go:build !nometrics
|
||||
// +build !nometrics
|
||||
|
||||
// Package metrics provides Prometheus metrics support
|
||||
// Package metric provides Prometheus metrics support
|
||||
package metric
|
||||
|
||||
import (
|
||||
|
|
|
@ -175,6 +175,7 @@ type UserFilters struct {
|
|||
UserType string `json:"user_type,omitempty"`
|
||||
}
|
||||
|
||||
// BaseUser defines the shared user fields
|
||||
type BaseUser struct {
|
||||
// Data provider unique identifier
|
||||
ID int64 `json:"id"`
|
||||
|
|
|
@ -163,6 +163,7 @@ func RenderRetentionReportTemplate(buf *bytes.Buffer, data interface{}) error {
|
|||
return emailTemplates[templateRetentionCheckResult].Execute(buf, data)
|
||||
}
|
||||
|
||||
// RenderPasswordResetTemplate executes the password reset template
|
||||
func RenderPasswordResetTemplate(buf *bytes.Buffer, data interface{}) error {
|
||||
if smtpServer == nil {
|
||||
return errors.New("smtp: not configured")
|
||||
|
|
Loading…
Reference in a new issue