Skip to content

Commit 65b9426

Browse files
committed
fix lints
Signed-off-by: cpanato <[email protected]>
1 parent 8f02e7d commit 65b9426

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+320
-259
lines changed

.golangci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,25 @@ issues:
8787
linters:
8888
enable-all: true
8989
disable:
90+
- bodyclose
91+
- contextcheck
92+
- cyclop
9093
- depguard
94+
- exhaustruct
95+
- err113
96+
- forcetypeassert
9197
- ireturn
98+
- interfacebloat
99+
- inamedparam
100+
- musttag
101+
- nonamedreturns
92102
- nilnil
93103
- tagliatelle
94104
- gomoddirectives
105+
- gochecknoglobals
106+
- varnamelen
107+
- protogetter
108+
- gomnd
109+
- mnd
110+
- wsl
111+
- wrapcheck

cmd/flintlock-metrics/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package main
33
import (
44
"os"
55

6-
"github.com/liquidmetal-dev/flintlock/internal/command/metrics"
76
"github.com/sirupsen/logrus"
7+
8+
"github.com/liquidmetal-dev/flintlock/internal/command/metrics"
89
)
910

1011
func main() {

core/application/commands.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import (
55
"encoding/base64"
66
"fmt"
77

8+
"github.com/sirupsen/logrus"
9+
"sigs.k8s.io/yaml"
10+
811
"github.com/liquidmetal-dev/flintlock/api/events"
912
"github.com/liquidmetal-dev/flintlock/client/cloudinit"
1013
"github.com/liquidmetal-dev/flintlock/client/cloudinit/instance"
@@ -14,8 +17,6 @@ import (
1417
"github.com/liquidmetal-dev/flintlock/pkg/defaults"
1518
"github.com/liquidmetal-dev/flintlock/pkg/log"
1619
"github.com/liquidmetal-dev/flintlock/pkg/validation"
17-
"github.com/sirupsen/logrus"
18-
"sigs.k8s.io/yaml"
1920
)
2021

2122
const (
@@ -216,6 +217,4 @@ func (a *app) addMetadataInterface(mvm *models.MicroVM) {
216217
}
217218
interfaces = append(interfaces, mvm.Spec.NetworkInterfaces...)
218219
mvm.Spec.NetworkInterfaces = interfaces
219-
220-
return
221220
}

core/application/reconcile.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"fmt"
66
"time"
77

8+
"github.com/sirupsen/logrus"
9+
810
"github.com/liquidmetal-dev/flintlock/api/events"
911
"github.com/liquidmetal-dev/flintlock/core/models"
1012
"github.com/liquidmetal-dev/flintlock/core/plans"
@@ -13,7 +15,6 @@ import (
1315
"github.com/liquidmetal-dev/flintlock/pkg/defaults"
1416
"github.com/liquidmetal-dev/flintlock/pkg/log"
1517
"github.com/liquidmetal-dev/flintlock/pkg/planner"
16-
"github.com/sirupsen/logrus"
1718
)
1819

1920
const backoffBaseInSeconds = 20

core/errors/errors.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var (
1717
ErrNoMount = errors.New("no image mount point")
1818
ErrNoVolumeMount = errors.New("no volume mount point")
1919
ErrParentIfaceRequiredForMacvtap = errors.New("a parent network device name is required for macvtap interfaces")
20-
ErrParentIfaceRequiredForAttachingTap = errors.New("a parent network device name is required for attaching a TAP interface")
20+
ErrParentIfaceRequiredForAttachingTap = errors.New("a parent network device name is required for attaching a TAP interface") //nolint: lll // that is okay
2121
ErrGuestDeviceNameRequired = errors.New("a guest device name is required")
2222
ErrUnsupportedIfaceType = errors.New("unsupported network interface type")
2323
ErrIfaceNotFound = errors.New("network interface not found")
@@ -41,7 +41,7 @@ type IncorrectVMIDFormatError struct {
4141

4242
// Error returns the error message.
4343
func (e IncorrectVMIDFormatError) Error() string {
44-
return fmt.Sprintf("unexpected vmid format: %s", e.ActualID)
44+
return "unexpected vmid format: " + e.ActualID
4545
}
4646

4747
func NewErrUnsupportedInterface(ifaceType string) UnsupportedInterfaceError {
@@ -136,7 +136,7 @@ type notSupportedError struct {
136136

137137
// Error returns the error message.
138138
func (e notSupportedError) Error() string {
139-
return fmt.Sprintf("%s is not supported", e.unsupported)
139+
return e.unsupported + "is not supported"
140140
}
141141

142142
// IsNotSupported tests an error to see if its a not supported error.

core/plans/types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package plans
22

33
import (
4-
"github.com/liquidmetal-dev/flintlock/core/ports"
54
"github.com/spf13/afero"
5+
6+
"github.com/liquidmetal-dev/flintlock/core/ports"
67
)
78

89
// Providers input is a type to be used as input to plans.

core/steps/cloudinit/disk_mount.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (s *diskMountStep) Do(ctx context.Context) ([]planner.Procedure, error) {
119119
return nil, nil
120120
}
121121

122-
func (s *diskMountStep) Verify(ctx context.Context) error {
122+
func (s *diskMountStep) Verify(_ context.Context) error {
123123
return nil
124124
}
125125

core/steps/event/publish.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (s *eventPublish) Name() string {
2929
return "event_publish"
3030
}
3131

32-
func (s *eventPublish) ShouldDo(ctx context.Context) (bool, error) {
32+
func (s *eventPublish) ShouldDo(_ context.Context) (bool, error) {
3333
return true, nil
3434
}
3535

@@ -47,6 +47,6 @@ func (s *eventPublish) Do(ctx context.Context) ([]planner.Procedure, error) {
4747
return nil, nil
4848
}
4949

50-
func (s *eventPublish) Verify(ctx context.Context) error {
50+
func (s *eventPublish) Verify(_ context.Context) error {
5151
return nil
5252
}

core/steps/microvm/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ func (s *createStep) Do(ctx context.Context) ([]planner.Procedure, error) {
6363
return nil, nil
6464
}
6565

66-
func (s *createStep) Verify(ctx context.Context) error {
66+
func (s *createStep) Verify(_ context.Context) error {
6767
return nil
6868
}

core/steps/microvm/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ func (s *deleteStep) Do(ctx context.Context) ([]planner.Procedure, error) {
6060
return nil, nil
6161
}
6262

63-
func (s *deleteStep) Verify(ctx context.Context) error {
63+
func (s *deleteStep) Verify(_ context.Context) error {
6464
return nil
6565
}

0 commit comments

Comments
 (0)