Add and fix errorlint
This commit is contained in:
parent
2dde1242cf
commit
0c45f8d252
4 changed files with 5 additions and 6 deletions
|
@ -29,11 +29,9 @@ linters:
|
|||
- gocritic
|
||||
|
||||
# We should strive to enable these:
|
||||
- testpackage
|
||||
- stylecheck
|
||||
- wrapcheck
|
||||
- goerr113
|
||||
- errorlint
|
||||
- forcetypeassert
|
||||
- errname
|
||||
- gosec
|
||||
|
@ -46,6 +44,7 @@ linters:
|
|||
- cyclop
|
||||
- nestif
|
||||
- wsl # might be incompatible with gofumpt
|
||||
- testpackage
|
||||
|
||||
linters-settings:
|
||||
varnamelen:
|
||||
|
|
|
@ -53,7 +53,7 @@ func LoadConfig(path string) error {
|
|||
viper.SetDefault("cli.timeout", "5s")
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
return fmt.Errorf("Fatal error reading config file: %s \n", err)
|
||||
return fmt.Errorf("Fatal error reading config file: %w", err)
|
||||
}
|
||||
|
||||
// Collect any validation errors and return them all at once
|
||||
|
|
|
@ -284,7 +284,7 @@ func (h *Headscale) UpdateMachine(machine *Machine) error {
|
|||
// DeleteMachine softs deletes a Machine from the database.
|
||||
func (h *Headscale) DeleteMachine(machine *Machine) error {
|
||||
err := h.RemoveSharedMachineFromAllNamespaces(machine)
|
||||
if err != nil && err != errorMachineNotShared {
|
||||
if err != nil && errors.Is(err, errorMachineNotShared) {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ func (h *Headscale) DeleteMachine(machine *Machine) error {
|
|||
// HardDeleteMachine hard deletes a Machine from the database.
|
||||
func (h *Headscale) HardDeleteMachine(machine *Machine) error {
|
||||
err := h.RemoveSharedMachineFromAllNamespaces(machine)
|
||||
if err != nil && err != errorMachineNotShared {
|
||||
if err != nil && errors.Is(err, errorMachineNotShared) {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
2
utils.go
2
utils.go
|
@ -46,7 +46,7 @@ func decodeMsg(
|
|||
}
|
||||
// fmt.Println(string(decrypted))
|
||||
if err := json.Unmarshal(decrypted, output); err != nil {
|
||||
return fmt.Errorf("response: %v", err)
|
||||
return fmt.Errorf("response: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue