Skip to content

Commit e70bf62

Browse files
committed
fix lint
1 parent 360a505 commit e70bf62

5 files changed

Lines changed: 92 additions & 104 deletions

File tree

.golangci.yml

Lines changed: 81 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,109 @@
11
run:
2-
timeout: 5m
3-
go: "1.23"
4-
modules-download-mode: readonly
5-
2+
build-tags:
3+
- tasks
64
linters-settings:
7-
govet:
8-
check-shadowing: true
5+
goimports:
6+
local-prefixes: github.com/brevdev/dev-plane
7+
revive:
8+
min-confidence: 0.8
9+
rules:
10+
- name: blank-imports
11+
- name: context-as-argument
12+
- name: context-as-argument
13+
- name: context-keys-type
14+
- name: dot-imports
15+
- name: error-return
16+
- name: error-strings
17+
- name: error-naming
18+
- name: if-return
19+
- name: increment-decrement
20+
- name: var-naming
21+
- name: var-declaration
22+
# - name: package-comments
23+
- name: range
24+
- name: receiver-naming
25+
- name: time-naming
26+
- name: unexported-return
27+
- name: errorf
28+
- name: empty-block
29+
- name: superfluous-else
30+
- name: unused-parameter
31+
- name: unreachable-code
32+
- name: redefines-builtin-id
933
gocyclo:
1034
min-complexity: 15
11-
maligned:
12-
suggest-new: true
13-
dupl:
14-
threshold: 100
15-
goconst:
16-
min-len: 2
17-
min-occurrences: 3
1835
misspell:
1936
locale: US
20-
lll:
21-
line-length: 140
22-
goimports:
23-
local-prefixes: github.com/brevdev/compute
24-
gocritic:
25-
enabled-tags:
26-
- diagnostic
27-
- experimental
28-
- opinionated
29-
- performance
30-
- style
31-
disabled-checks:
32-
- dupImport # https://github.com/go-critic/go-critic/issues/845
33-
- ifElseChain
34-
- octalLiteral
35-
- whyNoLint
36-
- wrapperFunc
37+
nolintlint:
38+
allow-leading-space: false # require machine-readable nolint directives (with no leading space)
39+
allow-unused: false # report any unused nolint directives
40+
require-explanation: true # require an explanation for nolint directives
41+
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
42+
funlen:
43+
lines: 100
44+
errcheck:
45+
exclude-functions:
46+
- (*encoding/json.Encoder).Encode
47+
wrapcheck:
48+
ignoreSigs:
49+
- .WrapAndTrace
50+
- .Errorf
51+
- .Wrap
52+
- .New
53+
- .ValidateStruct
54+
- .Permanent
55+
- .Decode
56+
stylecheck:
57+
checks: ["all", "-ST1020", "-ST1000", "-ST1021"]
3758

3859
linters:
60+
# please, do not use `enable-all`: it's deprecated and will be removed soon.
61+
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
3962
disable-all: true
4063
enable:
64+
- errcheck
65+
# - gosimple # don't like
66+
- govet
67+
- ineffassign
68+
# - staticcheck # broken in collections pkg?
69+
- typecheck
4170
- bodyclose
42-
- deadcode
43-
- depguard
44-
- dogsled
71+
- unused
72+
# - depguard
4573
- dupl
46-
- errcheck
47-
- exportloopref
48-
- exhaustive
49-
- forbidigo
74+
- copyloopvar
75+
- forcetypeassert
5076
- funlen
51-
- gochecknoinits
77+
# - gci # don't like
78+
- gocognit
5279
- goconst
5380
- gocritic
5481
- gocyclo
55-
- gofmt
82+
# - godot # don't like
5683
- gofumpt
57-
- goheader
58-
- goimports
59-
- gomnd
60-
- gomodguard
84+
- revive
85+
# - gomnd # don't like
6186
- goprintffuncname
6287
- gosec
63-
- gosimple
64-
- govet
65-
- ineffassign
66-
- lll
67-
- makezero
88+
# - ifshort # don't like
6889
- misspell
69-
- nakedret
7090
- noctx
7191
- nolintlint
72-
- prealloc
73-
- predeclared
74-
- promlinter
75-
- revive
76-
- rowserrcheck
77-
- staticcheck
78-
- structcheck
92+
- rowserrcheck # broken with generics
93+
- sqlclosecheck # broken with generics
7994
- stylecheck
80-
- thelper
95+
# - thelper
8196
- tparallel
82-
- typecheck
8397
- unconvert
8498
- unparam
85-
- unused
86-
- varcheck
8799
- whitespace
88-
- wrapcheck
89-
100+
# - errorlint
101+
# - goerr113
102+
# - wrapcheck
90103
issues:
91-
exclude-rules:
92-
- path: _test\.go
93-
linters:
94-
- gomnd
95-
- goconst
96-
- funlen
97-
- gocyclo
98-
- dupl
99-
- gocritic
100-
- gosec
101-
- lll
102-
- maligned
103-
- noctx
104-
- prealloc
105-
- predeclared
106-
- revive
107-
- structcheck
108-
- thelper
109-
- tparallel
110-
- unconvert
111-
- unparam
112-
- varcheck
113-
- wrapcheck
114-
- path: pkg/v1/
115-
linters:
116-
- gosec # Disable security checks for public API
117-
- path: internal/
118-
linters:
119-
- gosec # Disable security checks for internal code
120-
max-issues-per-linter: 0
121-
max-same-issues: 0
104+
# enable issues excluded by default
105+
exclude-use-default: false
106+
exclude:
107+
- composites
108+
exclude-dirs:
109+
- internal/lambdalabs/gen

internal/lambdalabs/v1/capabilities.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
// GetCapabilities returns the capabilities of Lambda Labs
1010
// Based on API documentation at https://cloud.lambda.ai/api/v1/openapi.json
11-
func (c *LambdaLabsClient) GetCapabilities(ctx context.Context) (v1.Capabilities, error) {
11+
func (c *LambdaLabsClient) GetCapabilities(_ context.Context) (v1.Capabilities, error) {
1212
capabilities := v1.Capabilities{
1313
// SUPPORTED FEATURES (with API evidence):
1414

internal/lambdalabs/v1/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (c *LambdaLabsClient) GetCloudProviderID() v1.CloudProviderID {
3535
}
3636

3737
// MakeClient creates a new client instance
38-
func (c *LambdaLabsClient) MakeClient(ctx context.Context, location string) (v1.CloudClient, error) {
38+
func (c *LambdaLabsClient) MakeClient(_ context.Context, _ string) (v1.CloudClient, error) {
3939
// Lambda Labs doesn't require location-specific clients
4040
return c, nil
4141
}

internal/lambdalabs/v1/instance.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
// CreateInstance creates a new instance in Lambda Labs
1212
// Supported via: POST /api/v1/instance-operations/launch
13-
func (c *LambdaLabsClient) CreateInstance(ctx context.Context, attrs v1.CreateInstanceAttrs) (*v1.Instance, error) {
13+
func (c *LambdaLabsClient) CreateInstance(_ context.Context, attrs v1.CreateInstanceAttrs) (*v1.Instance, error) {
1414
// TODO: Implement Lambda Labs instance creation
1515
// This would typically involve:
1616
// 1. Validating the instance type and location
@@ -37,40 +37,40 @@ func (c *LambdaLabsClient) CreateInstance(ctx context.Context, attrs v1.CreateIn
3737

3838
// GetInstance retrieves an instance by ID
3939
// Supported via: GET /api/v1/instances/{id}
40-
func (c *LambdaLabsClient) GetInstance(ctx context.Context, id v1.CloudProviderInstanceID) (*v1.Instance, error) {
40+
func (c *LambdaLabsClient) GetInstance(_ context.Context, _ v1.CloudProviderInstanceID) (*v1.Instance, error) {
4141
// TODO: Implement Lambda Labs instance retrieval
4242
return nil, fmt.Errorf("not implemented")
4343
}
4444

4545
// TerminateInstance terminates an instance
4646
// Supported via: POST /api/v1/instance-operations/terminate
47-
func (c *LambdaLabsClient) TerminateInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) error {
47+
func (c *LambdaLabsClient) TerminateInstance(_ context.Context, _ v1.CloudProviderInstanceID) error {
4848
// TODO: Implement Lambda Labs instance termination
4949
return fmt.Errorf("not implemented")
5050
}
5151

5252
// ListInstances lists all instances
5353
// Supported via: GET /api/v1/instances
54-
func (c *LambdaLabsClient) ListInstances(ctx context.Context, args v1.ListInstancesArgs) ([]v1.Instance, error) {
54+
func (c *LambdaLabsClient) ListInstances(_ context.Context, _ v1.ListInstancesArgs) ([]v1.Instance, error) {
5555
// TODO: Implement Lambda Labs instance listing
5656
return nil, fmt.Errorf("not implemented")
5757
}
5858

5959
// RebootInstance reboots an instance
6060
// Supported via: POST /api/v1/instance-operations/restart
61-
func (c *LambdaLabsClient) RebootInstance(ctx context.Context, instanceID v1.CloudProviderInstanceID) error {
61+
func (c *LambdaLabsClient) RebootInstance(_ context.Context, _ v1.CloudProviderInstanceID) error {
6262
// TODO: Implement Lambda Labs instance rebooting
6363
return fmt.Errorf("not implemented")
6464
}
6565

6666
// MergeInstanceForUpdate merges instance data for updates
67-
func (c *LambdaLabsClient) MergeInstanceForUpdate(currInst v1.Instance, newInst v1.Instance) v1.Instance {
67+
func (c *LambdaLabsClient) MergeInstanceForUpdate(_ v1.Instance, newInst v1.Instance) v1.Instance {
6868
// TODO: Implement instance merging logic
6969
return newInst
7070
}
7171

7272
// MergeInstanceTypeForUpdate merges instance type data for updates
73-
func (c *LambdaLabsClient) MergeInstanceTypeForUpdate(currIt v1.InstanceType, newIt v1.InstanceType) v1.InstanceType {
73+
func (c *LambdaLabsClient) MergeInstanceTypeForUpdate(_ v1.InstanceType, newIt v1.InstanceType) v1.InstanceType {
7474
// TODO: Implement instance type merging logic
7575
return newIt
7676
}

internal/lambdalabs/v1/instancetype.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
// GetInstanceTypes retrieves available instance types from Lambda Labs
1212
// Supported via: GET /api/v1/instance-types
13-
func (c *LambdaLabsClient) GetInstanceTypes(ctx context.Context, args v1.GetInstanceTypeArgs) ([]v1.InstanceType, error) {
13+
func (c *LambdaLabsClient) GetInstanceTypes(_ context.Context, _ v1.GetInstanceTypeArgs) ([]v1.InstanceType, error) {
1414
// TODO: Implement Lambda Labs instance type retrieval
1515
// This would typically involve:
1616
// 1. Calling Lambda Labs API to get available instance types
@@ -48,6 +48,6 @@ func (c *LambdaLabsClient) GetInstanceTypePollTime() time.Duration {
4848

4949
// GetLocations retrieves available locations from Lambda Labs
5050
// UNSUPPORTED: No location listing endpoints found in Lambda Labs API
51-
func (c *LambdaLabsClient) GetLocations(ctx context.Context, args v1.GetLocationsArgs) ([]v1.Location, error) {
51+
func (c *LambdaLabsClient) GetLocations(_ context.Context, _ v1.GetLocationsArgs) ([]v1.Location, error) {
5252
return nil, v1.ErrNotImplemented
5353
}

0 commit comments

Comments
 (0)