mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
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
|
- gocritic
|
||||||
|
|
||||||
# We should strive to enable these:
|
# We should strive to enable these:
|
||||||
- testpackage
|
|
||||||
- stylecheck
|
- stylecheck
|
||||||
- wrapcheck
|
- wrapcheck
|
||||||
- goerr113
|
- goerr113
|
||||||
- errorlint
|
|
||||||
- forcetypeassert
|
- forcetypeassert
|
||||||
- errname
|
- errname
|
||||||
- gosec
|
- gosec
|
||||||
|
@ -46,6 +44,7 @@ linters:
|
||||||
- cyclop
|
- cyclop
|
||||||
- nestif
|
- nestif
|
||||||
- wsl # might be incompatible with gofumpt
|
- wsl # might be incompatible with gofumpt
|
||||||
|
- testpackage
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
varnamelen:
|
varnamelen:
|
||||||
|
|
|
@ -53,7 +53,7 @@ func LoadConfig(path string) error {
|
||||||
viper.SetDefault("cli.timeout", "5s")
|
viper.SetDefault("cli.timeout", "5s")
|
||||||
|
|
||||||
if err := viper.ReadInConfig(); err != nil {
|
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
|
// 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.
|
// DeleteMachine softs deletes a Machine from the database.
|
||||||
func (h *Headscale) DeleteMachine(machine *Machine) error {
|
func (h *Headscale) DeleteMachine(machine *Machine) error {
|
||||||
err := h.RemoveSharedMachineFromAllNamespaces(machine)
|
err := h.RemoveSharedMachineFromAllNamespaces(machine)
|
||||||
if err != nil && err != errorMachineNotShared {
|
if err != nil && errors.Is(err, errorMachineNotShared) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ func (h *Headscale) DeleteMachine(machine *Machine) error {
|
||||||
// HardDeleteMachine hard deletes a Machine from the database.
|
// HardDeleteMachine hard deletes a Machine from the database.
|
||||||
func (h *Headscale) HardDeleteMachine(machine *Machine) error {
|
func (h *Headscale) HardDeleteMachine(machine *Machine) error {
|
||||||
err := h.RemoveSharedMachineFromAllNamespaces(machine)
|
err := h.RemoveSharedMachineFromAllNamespaces(machine)
|
||||||
if err != nil && err != errorMachineNotShared {
|
if err != nil && errors.Is(err, errorMachineNotShared) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
utils.go
2
utils.go
|
@ -46,7 +46,7 @@ func decodeMsg(
|
||||||
}
|
}
|
||||||
// fmt.Println(string(decrypted))
|
// fmt.Println(string(decrypted))
|
||||||
if err := json.Unmarshal(decrypted, output); err != nil {
|
if err := json.Unmarshal(decrypted, output); err != nil {
|
||||||
return fmt.Errorf("response: %v", err)
|
return fmt.Errorf("response: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue