Skip to content

Commit d0004fb

Browse files
committed
STAC-0: fix fresh linting issues
1 parent 54047c1 commit d0004fb

7 files changed

Lines changed: 16 additions & 12 deletions

File tree

cmd/dashboard/dashboard_edit_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func TestShouldEditDashboard(t *testing.T) {
9696
"scope": "privateDashboard"
9797
}`),
9898
}
99-
cli.Deps.Editor = mockEditor
99+
cli.Editor = mockEditor
100100

101101
di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--id", "1234")
102102

@@ -136,7 +136,7 @@ func TestShouldEditDashboardWithIdentifier(t *testing.T) {
136136
"description": "Updated via identifier"
137137
}`),
138138
}
139-
cli.Deps.Editor = mockEditor
139+
cli.Editor = mockEditor
140140

141141
di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--identifier", "urn:custom:dashboard:edit-test")
142142

@@ -153,7 +153,7 @@ func TestEditDashboardNoChanges(t *testing.T) {
153153

154154
// Custom editor that returns exactly the same content as input
155155
noChangeEditor := &NoChangeEditor{}
156-
cli.Deps.Editor = noChangeEditor
156+
cli.Editor = noChangeEditor
157157

158158
di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--id", "1234")
159159

@@ -186,7 +186,7 @@ func TestEditDashboardWithJsonOutput(t *testing.T) {
186186
"description": "Testing JSON output"
187187
}`),
188188
}
189-
cli.Deps.Editor = mockEditor
189+
cli.Editor = mockEditor
190190

191191
di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--id", "1234", "--output", "json")
192192

@@ -204,7 +204,7 @@ func TestEditDashboardNoChangesJsonOutput(t *testing.T) {
204204

205205
// Use NoChangeEditor that returns exactly the same content
206206
noChangeEditor := &NoChangeEditor{}
207-
cli.Deps.Editor = noChangeEditor
207+
cli.Editor = noChangeEditor
208208

209209
di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--id", "1234", "--output", "json")
210210

@@ -223,6 +223,7 @@ func TestEditDashboardInvalidJson(t *testing.T) {
223223
mockEditor := &MockEditor{
224224
Content: []byte(`{"invalid": json syntax}`),
225225
}
226+
//nolint:staticcheck
226227
cli.Deps.Editor = mockEditor
227228

228229
_, err := di.ExecuteCommandWithContext(&cli.Deps, cmd, "--id", "1234")
@@ -242,6 +243,7 @@ func TestEditDashboardEditorError(t *testing.T) {
242243
mockEditor := &MockEditor{
243244
Error: errors.New("editor failed to open"),
244245
}
246+
//nolint:staticcheck
245247
cli.Deps.Editor = mockEditor
246248

247249
_, err := di.ExecuteCommandWithContext(&cli.Deps, cmd, "--id", "1234")
@@ -275,7 +277,7 @@ func TestEditDashboardUsesReverseEditorByDefault(t *testing.T) {
275277
mockEditor := &MockEditor{
276278
Content: []byte(`{"name": "changed-by-reverse-editor"}`),
277279
}
278-
cli.Deps.Editor = mockEditor
280+
cli.Editor = mockEditor
279281

280282
di.ExecuteCommandWithContextUnsafe(&cli.Deps, cmd, "--id", "1234")
281283

@@ -324,7 +326,7 @@ func TestEditDashboardApiErrors(t *testing.T) {
324326
mockEditor := &MockEditor{
325327
Content: []byte(`{"name": "changed"}`),
326328
}
327-
cli.Deps.Editor = mockEditor
329+
cli.Editor = mockEditor
328330
}
329331

330332
_, err := di.ExecuteCommandWithContext(&cli.Deps, cmd, "--id", "1234")

cmd/stackpack/stackpack_describe.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func RunStackpackDescribeCommand(args *DescribeArgs) di.CmdWithApiFn {
8585
}
8686
}
8787

88+
//nolint:staticcheck
8889
notFound := fmt.Errorf("StackPack '%s' not found.", args.Name)
8990
if cli.IsJson() {
9091
cli.Printer.PrintErrJson(notFound)

cmd/stackpack/stackpack_test_cmd_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ func TestConfirmUpload(t *testing.T) {
437437
// In a real test environment, you'd mock the stdin reader
438438

439439
// Just verify the function signature is correct
440+
//nolint:staticcheck
440441
var confirmFunc func(*di.Deps, string) bool = confirmUpload
441442
assert.NotNil(t, confirmFunc)
442443

internal/client/stackstate_version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ func CheckVersionCompatibility(version stackstate_api.ServerVersion, minVersion
6363
}
6464

6565
func NewAPIVersionMismatchError(got string, expected string) common.CLIError {
66-
return common.NewAPIVersionError(fmt.Errorf("Incompatible API version: got '%s', but need '%s'-compatible version", got, expected))
66+
return common.NewAPIVersionError(fmt.Errorf("incompatible API version: got '%s', but need '%s'-compatible version", got, expected))
6767
}

internal/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (c *Config) GetContext(name string) (*NamedContext, common.CLIError) {
8181
}
8282
}
8383

84-
return nil, common.NewNotFoundError(fmt.Errorf("Context with name '%s' not found", name))
84+
return nil, common.NewNotFoundError(fmt.Errorf("context with name '%s' not found", name))
8585
}
8686

8787
// UnmarshalYAML unmarshals the StsContext YAML part into a struct, ensuring that any defaults are set.
@@ -153,7 +153,7 @@ func (c *StsContext) Validate(contextName string) common.CLIError {
153153

154154
authenticationTokens := util.RemoveEmpty([]string{c.APIToken, c.ServiceToken, c.K8sSAToken})
155155
if len(authenticationTokens) > 1 {
156-
errors = append(errors, fmt.Errorf("Can only specify one of {api-token | service-token | k8s-sa-token}"))
156+
errors = append(errors, fmt.Errorf("can only specify one of {api-token | service-token | k8s-sa-token}"))
157157
}
158158

159159
if c.HasCaCertificateFromArgSet() {

internal/config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ current-context: default
181181
assert.NoError(t, err)
182182
assert.ErrorContains(t, c.Contexts[0].Context.Validate(c.Contexts[0].Name), `Failed to validate the 'default' context:
183183
* URL localhost:8080 must start with "https://" or "http://"
184-
* Can only specify one of {api-token | service-token | k8s-sa-token}`)
184+
* can only specify one of {api-token | service-token | k8s-sa-token}`)
185185
}
186186

187187
func TestMergeWithNoTokenOverride(t *testing.T) {

pkg/pflags/relative_time_flag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (d *RelativeTimeValue) Type() string {
116116
return RelativeTimeFlagType
117117
}
118118

119-
func (d *RelativeTimeValue) String() string { return d.Time.Format(time.RFC3339Nano) }
119+
func (d *RelativeTimeValue) String() string { return d.Format(time.RFC3339Nano) }
120120

121121
// GetRelativeTime return the time value of a flag with the given name
122122
func GetRelativeTime(f *pflag.FlagSet, name string) (time.Time, error) {

0 commit comments

Comments
 (0)