Skip to content

Commit acd2436

Browse files
committed
golanci-lint: fixes for staticcheck
1 parent 387c346 commit acd2436

File tree

7 files changed

+11
-13
lines changed

7 files changed

+11
-13
lines changed

internal/cmd/cloud.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ func (c *cmdCloud) run(cmd *cobra.Command, args []string) error {
300300
}
301301

302302
if testProgress == nil {
303-
//nolint:stylecheck,golint
303+
//nolint:staticcheck
304304
return errext.WithExitCodeIfNone(errors.New("Test progress error"), exitcodes.CloudFailedToGetProgress)
305305
}
306306

@@ -320,11 +320,12 @@ func (c *cmdCloud) run(cmd *cobra.Command, args []string) error {
320320
// when thresholds have been crossed (failed). So, we report this situation as such.
321321
if testProgress.RunStatus == cloudapi.RunStatusFinished ||
322322
testProgress.RunStatus == cloudapi.RunStatusAbortedThreshold {
323+
//nolint:staticcheck
323324
return errext.WithExitCodeIfNone(errors.New("Thresholds have been crossed"), exitcodes.ThresholdsHaveFailed)
324325
}
325326

326327
// TODO: use different exit codes for failed thresholds vs failed test (e.g. aborted by system/limit)
327-
return errext.WithExitCodeIfNone(errors.New("The test has failed"), exitcodes.CloudTestRunFailed)
328+
return errext.WithExitCodeIfNone(errors.New("The test has failed"), exitcodes.CloudTestRunFailed) //nolint:staticcheck
328329
}
329330

330331
return nil

internal/cmd/scale.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func getCmdScale(gs *state.GlobalState) *cobra.Command {
2222
vus := getNullInt64(cmd.Flags(), "vus")
2323
maxVUs := getNullInt64(cmd.Flags(), "max")
2424
if !vus.Valid && !maxVUs.Valid {
25-
return errors.New("Specify either -u/--vus or -m/--max") //nolint:golint,stylecheck
25+
return errors.New("Specify either -u/--vus or -m/--max") //nolint:staticcheck
2626
}
2727

2828
c, err := client.New(gs.Flags.Address)

internal/js/eventloop/eventloop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (e *EventLoop) Start(firstCallback func() error) error {
193193
}
194194
}
195195
// this is the de facto wording in both firefox and deno at least
196-
return fmt.Errorf("Uncaught (in promise) %s", value) //nolint:stylecheck
196+
return fmt.Errorf("Uncaught (in promise) %s", value) //nolint:stylecheck,staticcheck
197197
}
198198
}
199199
}

internal/js/modules/k6/experimental/streams/readable_stream_default_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func (controller *ReadableStreamDefaultController) pullSteps(readRequest ReadReq
220220
// [specification]: https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaultcontroller-releasesteps
221221
func (controller *ReadableStreamDefaultController) releaseSteps() {
222222
// 1.
223-
return //nolint:gosimple
223+
return //nolint:gosimple,staticcheck
224224
}
225225

226226
// close implements the [ReadableStreamDefaultControllerClose] algorithm

internal/loader/loader.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ func Load(
138138
scheme := moduleSpecifier.Scheme
139139
if scheme == "" {
140140
if moduleSpecifier.Opaque == "" {
141-
//nolint:stylecheck
142-
return nil, fmt.Errorf(fileSchemeCouldntBeLoadedMsg, originalModuleSpecifier)
141+
return nil, fmt.Errorf(fileSchemeCouldntBeLoadedMsg, originalModuleSpecifier) //nolint:staticcheck
143142
}
144143
scheme = "https"
145144
}
@@ -158,16 +157,15 @@ func Load(
158157
return nil, err
159158
}
160159
if scheme != "https" {
161-
//nolint:stylecheck
162-
return nil, fmt.Errorf(fileSchemeCouldntBeLoadedMsg, originalModuleSpecifier)
160+
return nil, fmt.Errorf(fileSchemeCouldntBeLoadedMsg, originalModuleSpecifier) //nolint:staticcheck
163161
}
164162

165163
finalModuleSpecifierURL := moduleSpecifier
166164

167165
var result *SourceData
168166
result, err = loadRemoteURL(logger, finalModuleSpecifierURL)
169167
if err != nil {
170-
//nolint:stylecheck
168+
//nolint:staticcheck
171169
return nil, fmt.Errorf(httpsSchemeCouldntBeLoadedMsg, originalModuleSpecifier, finalModuleSpecifierURL, err)
172170
}
173171
result.URL = moduleSpecifier

internal/loader/readsource.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ func ReadSource(
4949
if err != nil {
5050
var unresolvedError unresolvableURLError
5151
if errors.As(err, &unresolvedError) {
52-
//nolint:stylecheck
53-
return nil, fmt.Errorf(fileSchemeCouldntBeLoadedMsg, (string)(unresolvedError))
52+
return nil, fmt.Errorf(fileSchemeCouldntBeLoadedMsg, (string)(unresolvedError)) //nolint:staticcheck
5453
}
5554
return nil, err
5655
}

metrics/registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (r *Registry) NewMetric(name string, typ MetricType, t ...ValueType) (*Metr
4545
defer r.l.Unlock()
4646

4747
if !checkName(name) {
48-
return nil, fmt.Errorf("Invalid metric name: '%s'. %s", name, badNameWarning) //nolint:golint,stylecheck
48+
return nil, fmt.Errorf("Invalid metric name: '%s'. %s", name, badNameWarning) //nolint:staticcheck
4949
}
5050
oldMetric, ok := r.metrics[name]
5151

0 commit comments

Comments
 (0)