Skip to content

Commit

Permalink
fix golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rancoud committed Apr 27, 2024
1 parent 9884aee commit df12beb
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ linters:
- scopelint
- structcheck
- varcheck
- intrange

issues:
max-issues-per-linter: 0
max-same-issues: 0

linters-settings:
lll:
Expand Down
1 change: 1 addition & 0 deletions configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func ReadConfiguration(fsys fs.FS, filename string) (*Configuration, error) {

config := Configuration{}

//nolint:musttag
err = json.Unmarshal(filedata, &config)
if err != nil {
return nil, fmt.Errorf("%w", err)
Expand Down
2 changes: 0 additions & 2 deletions configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ func TestReadConfiguration_Errors(t *testing.T) {
}

for testCaseName, testCase := range testCases {
testCaseName, testCase := testCaseName, testCase

t.Run(testCaseName, func(tt *testing.T) {
tt.Parallel()

Expand Down
6 changes: 3 additions & 3 deletions hack/lint.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ ENV GOFLAGS="-buildvcs=false"
RUN apk add --no-cache gcc linux-headers musl-dev
WORKDIR /src

FROM golangci/golangci-lint:latest-alpine AS golangci-lint
FROM golangci/golangci-lint:v1.57.2-alpine AS golangci-lint
FROM base AS lint
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \
--mount=type=cache,target=/root/.cache \
--mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \
golangci-lint run ./...
2 changes: 0 additions & 2 deletions healthchecks/healthchecks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ func TestNewHealthchecksManager_ErrorHasValidConfigurationInFile(t *testing.T) {
}

for testCaseName, testCase := range testCases {
testCaseName, testCase := testCaseName, testCase

t.Run(testCaseName, func(tt *testing.T) {
var bufferLogs bytes.Buffer
log.Logger = zerolog.New(&bufferLogs).Level(zerolog.TraceLevel).With().Logger()
Expand Down
8 changes: 4 additions & 4 deletions welcome/welcome_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestHandlers_OnMessageReactionAdd(t *testing.T) {
[]requestTest{
{method: "GET", host: "discord.com", uri: "/api/v9/channels/channel-123/messages?limit=100"},
{method: "POST", host: "discord.com", uri: "/api/v9/channels/channel-123/messages",
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null}`},
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null,"sticker_ids":null}`},
{method: "PUT", host: "discord.com", uri: "/api/v9/channels/channel-123/messages/123/reactions/my-emoji-1:emoji-123/@me"},
{method: "PUT", host: "discord.com", uri: "/api/v9/guilds/guild-123/members/user-id-456/roles/role-123"},
},
Expand Down Expand Up @@ -277,7 +277,7 @@ func TestHandlers_OnMessageReactionAdd_Errors(t *testing.T) {
[]requestTest{
{method: "GET", host: "discord.com", uri: "/api/v9/channels/channel-123/messages?limit=100"},
{method: "POST", host: "discord.com", uri: "/api/v9/channels/channel-123/messages",
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null}`},
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null,"sticker_ids":null}`},
{method: "PUT", host: "discord.com", uri: "/api/v9/channels/channel-123/messages/123/reactions/my-emoji-1:emoji-123/@me"},
{method: "PUT", host: "discord.com", uri: "/api/v9/guilds/guild-123/members/user-id-456/roles/role-123"},
},
Expand Down Expand Up @@ -377,7 +377,7 @@ func TestHandlers_OnMessageReactionRemove(t *testing.T) {
[]requestTest{
{method: "GET", host: "discord.com", uri: "/api/v9/channels/channel-123/messages?limit=100"},
{method: "POST", host: "discord.com", uri: "/api/v9/channels/channel-123/messages",
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null}`},
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null,"sticker_ids":null}`},
{method: "PUT", host: "discord.com", uri: "/api/v9/channels/channel-123/messages/123/reactions/my-emoji-1:emoji-123/@me"},
{method: "DELETE", host: "discord.com", uri: "/api/v9/guilds/guild-123/members/user-id-789/roles/role-123"},
},
Expand Down Expand Up @@ -566,7 +566,7 @@ func TestHandlers_OnMessageReactionRemove_Errors(t *testing.T) {
[]requestTest{
{method: "GET", host: "discord.com", uri: "/api/v9/channels/channel-123/messages?limit=100"},
{method: "POST", host: "discord.com", uri: "/api/v9/channels/channel-123/messages",
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null}`},
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null,"sticker_ids":null}`},
{method: "PUT", host: "discord.com", uri: "/api/v9/channels/channel-123/messages/123/reactions/my-emoji-1:emoji-123/@me"},
{method: "DELETE", host: "discord.com", uri: "/api/v9/guilds/guild-123/members/user-id-789/roles/role-123"},
},
Expand Down
6 changes: 3 additions & 3 deletions welcome/welcome_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestRun(t *testing.T) {
[]requestTest{
{method: "GET", host: "discord.com", uri: "/api/v9/channels/channel-123/messages?limit=100"},
{method: "POST", host: "discord.com", uri: "/api/v9/channels/channel-123/messages",
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null}`},
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null,"sticker_ids":null}`},
{method: "PUT", host: "discord.com", uri: "/api/v9/channels/channel-123/messages/123/reactions/my-emoji-1:emoji-123/@me"},
},
)
Expand Down Expand Up @@ -327,7 +327,7 @@ func TestRun_Errors(t *testing.T) {
[]requestTest{
{method: "GET", host: "discord.com", uri: "/api/v9/channels/channel-123/messages?limit=100"},
{method: "POST", host: "discord.com", uri: "/api/v9/channels/channel-123/messages",
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null}`},
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null,"sticker_ids":null}`},
},
)

Expand Down Expand Up @@ -389,7 +389,7 @@ func TestRun_Errors(t *testing.T) {
[]requestTest{
{method: "GET", host: "discord.com", uri: "/api/v9/channels/channel-123/messages?limit=100"},
{method: "POST", host: "discord.com", uri: "/api/v9/channels/channel-123/messages",
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null}`},
body: `{"embeds":[{"type":"rich","title":"my title 1"}],"tts":false,"components":null,"sticker_ids":null}`},
{method: "PUT", host: "discord.com", uri: "/api/v9/channels/channel-123/messages/123/reactions/my-emoji-1:emoji-123/@me"},
},
)
Expand Down

0 comments on commit df12beb

Please sign in to comment.