Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Scheduled] Update dependencies #212

Merged
merged 2 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 2 additions & 10 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,11 @@ linters:
- gomoddirectives
- nlreturn
- wsl
- exhaustivestruct
- maligned # deprecated
- scopelint # deprecated
- interfacer # deprecated
- golint # deprecated
- varcheck # deprecated
- ifshort # deprecated
- deadcode # deprecated
- nosnakecase # deprecated
- structcheck # deprecated
- usestdlibvars # needs to be fixed
- exhaustruct # needs to be fixed
- depguard
- gomnd
- execinquery

issues:
exclude-rules:
Expand Down
8 changes: 4 additions & 4 deletions clamd/clamd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func sendCommand(conn net.Conn, command string) error {
}

func readResponse(conn net.Conn) ([]byte, error) {
buf := make([]byte, 1024) //nolint:gomnd
buf := make([]byte, 1024) //nolint:mnd
n, err := conn.Read(buf)
if err != nil {
return nil, fmt.Errorf("failed to read response: %w", err)
Expand All @@ -60,9 +60,9 @@ func readResponse(conn net.Conn) ([]byte, error) {
func sendChunk(conn net.Conn, data []byte) error {
var buf [4]byte
lenData := len(data)
buf[0] = byte(lenData >> 24) //nolint:gomnd
buf[1] = byte(lenData >> 16) //nolint:gomnd
buf[2] = byte(lenData >> 8) //nolint:gomnd
buf[0] = byte(lenData >> 24) //nolint:mnd
buf[1] = byte(lenData >> 16) //nolint:mnd
buf[2] = byte(lenData >> 8) //nolint:mnd
buf[3] = byte(lenData >> 0)

a := buf
Expand Down
1 change: 0 additions & 1 deletion clamd/instream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func TestClamdInstream(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion clamd/ping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func TestClamdPing(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion clamd/reload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func TestClamdReload(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 1 addition & 1 deletion clamd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Version struct {
}

func parseVersion(response []byte) (Version, error) {
parts := strings.SplitN(string(response), " ", 2) //nolint:gomnd
parts := strings.SplitN(string(response), " ", 2) //nolint:mnd
return Version{
Version: parts[1],
}, nil
Expand Down
1 change: 0 additions & 1 deletion clamd/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func TestClamdVersion(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
4 changes: 2 additions & 2 deletions client/delete_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ func (c *Client) DeleteFile(
req, err := http.NewRequestWithContext(
ctx,
"DELETE",
c.baseURL+"/files/"+fileID, //nolint:goconst
c.baseURL+"/files/"+fileID,
nil,
)
if err != nil {
return fmt.Errorf("problem creating request: %w", err)
}
req.Header.Set("Authorization", "Bearer "+c.jwt) //nolint:goconst
req.Header.Set("Authorization", "Bearer "+c.jwt)

resp, err := c.httpClient.Do(req)
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions client/delete_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ func TestDeleteFile(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
tc := tc

err := cl.DeleteFile(context.Background(), tc.fileID)

if !cmp.Equal(err, tc.expectedErr) {
Expand Down
8 changes: 4 additions & 4 deletions client/get_file_information.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,28 @@ func WithRange(rangeV string) GetFileInformationOpt {
func WithIfMatch(etags ...string) GetFileInformationOpt {
return func(req *http.Request) {
for _, e := range etags {
req.Header.Add("if-match", e)
req.Header.Add("If-Match", e)
}
}
}

func WithNoneMatch(etags ...string) GetFileInformationOpt {
return func(req *http.Request) {
for _, e := range etags {
req.Header.Add("if-none-match", e)
req.Header.Add("If-None-Match", e)
}
}
}

func WithIfModifiedSince(modifiedSince string) GetFileInformationOpt {
return func(req *http.Request) {
req.Header.Add("if-modified-since", modifiedSince)
req.Header.Add("If-Modified-Since", modifiedSince)
}
}

func WithIfUnmodifiedSince(modifiedSince string) GetFileInformationOpt {
return func(req *http.Request) {
req.Header.Add("if-unmodified-since", modifiedSince)
req.Header.Add("If-Unmodified-Since", modifiedSince)
}
}

Expand Down
3 changes: 0 additions & 3 deletions client/get_file_information_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,7 @@ func TestGetFileInformation(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
tc := tc

got, err := cl.GetFileInformation(context.Background(), tc.id, tc.opts...)

if !cmp.Equal(err, tc.expectedErr) {
Expand Down
3 changes: 0 additions & 3 deletions client/get_file_presignedurl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ func TestGetFilePresignedURL(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
tc := tc

got, err := cl.GetFilePresignedURL(context.Background(), tc.id)
if !cmp.Equal(err, tc.expectedErr) {
t.Errorf(cmp.Diff(err, tc.expectedErr))
Expand Down
3 changes: 0 additions & 3 deletions client/get_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,7 @@ func TestGetFile(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
tc := tc

got, err := cl.GetFile(context.Background(), tc.id, tc.opts...)

if !cmp.Equal(err, tc.expectedErr) {
Expand Down
3 changes: 0 additions & 3 deletions client/update_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ func TestUpdateFile(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
tc := tc

got, err := updateFile(t, cl, tc.fileID, tc.file)

if !cmp.Equal(err, tc.expectedErr) {
Expand Down
3 changes: 0 additions & 3 deletions client/upload_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,7 @@ func TestUploadFile(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
tc := tc

got, err := uploadFiles(t, cl, tc.files...)

opts := cmp.Options{
Expand Down
4 changes: 2 additions & 2 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func corsConfig(allowedOrigins []string) cors.Config {
ExposeHeaders: []string{
"Content-Length", "Content-Type", "Cache-Control", "ETag", "Last-Modified", "X-Error",
},
MaxAge: 12 * time.Hour, //nolint: gomnd
MaxAge: 12 * time.Hour, //nolint: mnd
}
}

Expand All @@ -161,7 +161,7 @@ func (ctrl *Controller) SetupRouter(
}

// lower values make uploads slower but keeps service memory usage low
router.MaxMultipartMemory = 1 << 20 //nolint:gomnd // 1 MB
router.MaxMultipartMemory = 1 << 20 //nolint:mnd // 1 MB
router.Use(gin.Recovery())

for _, mw := range middleware {
Expand Down
3 changes: 0 additions & 3 deletions controller/delete_broken_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ func TestDeleteBrokenMetadata(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
tc := tc

t.Parallel()

logger := logrus.New()
Expand Down
2 changes: 0 additions & 2 deletions controller/delete_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ func TestDeleteFile(t *testing.T) {
logger.SetLevel(logrus.ErrorLevel)

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
tc := tc

c := gomock.NewController(t)
defer c.Finish()
Expand Down
3 changes: 0 additions & 3 deletions controller/delete_orphans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ func TestDeleteOrphans(t *testing.T) {
}

for _, tc := range cases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
tc := tc

t.Parallel()

logger := logrus.New()
Expand Down
36 changes: 17 additions & 19 deletions controller/get_file_information_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,59 +29,59 @@ func getFileTestCases() []struct {
requestHeaders: http.Header{},
},
{
name: "if-match matches",
name: "If-Match matches",
expectedStatus: 200,
requestHeaders: http.Header{
"if-match": {"\"55af1e60-0f28-454e-885e-ea6aab2bb288\""},
"If-Match": {"\"55af1e60-0f28-454e-885e-ea6aab2bb288\""},
},
},
{
name: "if-match doesn't match",
name: "If-Match doesn't match",
expectedStatus: 412,
requestHeaders: http.Header{
"if-match": {"blah"},
"If-Match": {"blah"},
},
},
{
name: "if-none-match matches",
name: "If-None-Match matches",
expectedStatus: 304,
requestHeaders: http.Header{
"if-none-match": {"\"55af1e60-0f28-454e-885e-ea6aab2bb288\""},
"If-None-Match": {"\"55af1e60-0f28-454e-885e-ea6aab2bb288\""},
},
},
{
name: "if-none-match doesn't match",
name: "If-None-Match doesn't match",
expectedStatus: 200,
requestHeaders: http.Header{
"if-none-match": {"blah"},
"If-None-Match": {"blah"},
},
},
{
name: "if-modified since matches",
name: "If-Modified since matches",
expectedStatus: 200,
requestHeaders: http.Header{
"if-modified-since": {"Wed, 15 Jan 2020 10:00:00 UTC"},
"If-Modified-since": {"Wed, 15 Jan 2020 10:00:00 UTC"},
},
},
{
name: "if-modified doesn't match",
name: "If-Modified doesn't match",
expectedStatus: 304,
requestHeaders: http.Header{
"if-modified-since": {"Thu, 25 Jan 2024 10:00:00 UTC"},
"If-Modified-since": {"Thu, 25 Jan 2024 10:00:00 UTC"},
},
},
{
name: "if-unmodified-since matches",
name: "If-Unmodified-Since matches",
expectedStatus: 200,
requestHeaders: http.Header{
"if-unmodified-since": {"Thu, 25 Jan 2024 10:00:00 UTC"},
"If-Unmodified-Since": {"Thu, 25 Jan 2024 10:00:00 UTC"},
},
},
{
name: "if-unmodified-since doesn't match",
name: "If-Unmodified-Since doesn't match",
expectedStatus: 412,
requestHeaders: http.Header{
"if-unmodified-since": {"Wed, 15 Jan 2020 10:00:00 UTC"},
"If-Unmodified-Since": {"Wed, 15 Jan 2020 10:00:00 UTC"},
},
},
}
Expand All @@ -97,8 +97,6 @@ func TestGetFileInfo(t *testing.T) {
logger.SetLevel(logrus.ErrorLevel)

for _, tc := range cases {
tc := tc

t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -158,7 +156,7 @@ func TestGetFileInfo(t *testing.T) {
nil,
)

req.Header.Add("x-hasura-user-id", "some-valid-uuid")
req.Header.Add("X-Hasura-User-Id", "some-valid-uuid")
for k, v := range tc.requestHeaders {
for _, vv := range v {
req.Header.Add(k, vv)
Expand Down
2 changes: 1 addition & 1 deletion controller/get_file_presigned_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (ctrl *Controller) getFilePresignedURL(
if apiErr != nil {
return GetFilePresignedURLResponse{},
apiErr.ExtendError(
fmt.Sprintf("problem creating presigned URL for file %s", fileMetadata.Name),
"problem creating presigned URL for file " + fileMetadata.Name,
)
}

Expand Down
2 changes: 0 additions & 2 deletions controller/get_file_presigned_url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ func TestGetFilePresignedURL(t *testing.T) {
logger.SetLevel(logrus.ErrorLevel)

for _, tc := range cases {
tc := tc

t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
4 changes: 1 addition & 3 deletions controller/get_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ func TestGetFile(t *testing.T) {
logger.SetLevel(logrus.ErrorLevel)

for _, tc := range cases {
tc := tc

t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -99,7 +97,7 @@ func TestGetFile(t *testing.T) {
nil,
)

req.Header.Add("x-hasura-user-id", "some-valid-uuid")
req.Header.Add("X-Hasura-User-Id", "some-valid-uuid")
for k, v := range tc.requestHeaders {
for _, vv := range v {
req.Header.Add(k, vv)
Expand Down
2 changes: 1 addition & 1 deletion controller/list_broken_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (ctrl *Controller) listBrokenMetadata(ctx *gin.Context) ([]FileSummary, *AP
return nil, apiErr
}

missing := make([]FileSummary, 0, 10) //nolint: gomnd
missing := make([]FileSummary, 0, 10) //nolint: mnd

for _, fileHasura := range filesInHasura {
found := false
Expand Down
Loading
Loading