Skip to content

Commit b3ece4d

Browse files
Updated client_test to solve lint error (#900)
* updated client_test to solve lint error * modified golangci yml to solve linter issues * minor change
1 parent 6d066bb commit b3ece4d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

.golangci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ linters-settings:
5757
# Default: true
5858
skipRecvDeref: false
5959

60-
gomnd:
60+
mnd:
6161
# List of function patterns to exclude from analysis.
6262
# Values always ignored: `time.Date`
6363
# Default: []
@@ -167,7 +167,7 @@ linters:
167167
- durationcheck # check for two durations multiplied together
168168
- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error.
169169
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
170-
- execinquery # execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds
170+
# Removed execinquery (deprecated). execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds
171171
- exhaustive # check exhaustiveness of enum switch statements
172172
- exportloopref # checks for pointers to enclosing loop variables
173173
- forbidigo # Forbids identifiers
@@ -180,14 +180,14 @@ linters:
180180
- gocyclo # Computes and checks the cyclomatic complexity of functions
181181
- godot # Check if comments end in a period
182182
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt.
183-
- gomnd # An analyzer to detect magic numbers.
184183
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
185184
- gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.
186185
- goprintffuncname # Checks that printf-like functions are named with f at the end
187186
- gosec # Inspects source code for security problems
188187
- lll # Reports long lines
189188
- makezero # Finds slice declarations with non-zero initial length
190189
# - nakedret # Finds naked returns in functions greater than a specified function length
190+
- mnd # An analyzer to detect magic numbers.
191191
- nestif # Reports deeply nested if statements
192192
- nilerr # Finds the code that returns nil even if it checks that the error is not nil.
193193
- nilnil # Checks that there is no simultaneous return of nil error and an invalid value.

client_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,14 @@ func TestClient_suffixWithAPIVersion(t *testing.T) {
513513
}
514514
defer func() {
515515
if r := recover(); r != nil {
516-
if r.(string) != tt.wantPanic {
517-
t.Errorf("suffixWithAPIVersion() = %v, want %v", r, tt.wantPanic)
516+
// Check if the panic message matches the expected panic message
517+
if rStr, ok := r.(string); ok {
518+
if rStr != tt.wantPanic {
519+
t.Errorf("suffixWithAPIVersion() = %v, want %v", rStr, tt.wantPanic)
520+
}
521+
} else {
522+
// If the panic is not a string, log it
523+
t.Errorf("suffixWithAPIVersion() panicked with non-string value: %v", r)
518524
}
519525
}
520526
}()

0 commit comments

Comments
 (0)