Skip to content

Conversation

alingse
Copy link
Contributor

@alingse alingse commented Mar 16, 2024

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers
under the terms of the Apache 2 license.
By creating this pull request I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 license.

Description

I write a linter to fix some bugs that occurred in my real work. --> https://github.com/alingse/sundrylint

in this case, it report the wrong params order for time.Parse, this should be time.Parse(layout, value)

and I run a github actions to check to most popular golang repos, here is minio failure

https://github.com/alingse/sundrylint/actions/runs/8309027408/job/22739917265

the linter output is

Error: /home/runner/work/sundrylint/sundrylint/minio/cmd/object-handlers.go:1724:29: call func time.Parse may have incorrect parameters, potentially swapping the layout and value arguments.
Error: /home/runner/work/sundrylint/sundrylint/minio/cmd/object-handlers.go:1[7](https://github.com/alingse/sundrylint/actions/runs/8309027408/job/22739917265#step:7:8)51:29: call func time.Parse may have incorrect parameters, potentially swapping the layout and value arguments.
Error: /home/runner/work/sundrylint/sundrylint/minio/cmd/object-handlers.go:1771:29: call func time.Parse may have incorrect parameters, potentially swapping the layout and value arguments.

Motivation and Context

Fix the PR

How to test this PR?

I don't know how to write a test for this part

maybe should add some attribute check in TestAPICopyObjectHandler?

If someone give a case, I would like to add one

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (If yes, please add commit-id or PR # here)
  • Unit tests added/updated
  • Internal documentation updated
  • Create a documentation update request here

@alingse alingse changed the title fix wrong time.Parse params fix wrong time.Parse params order Mar 16, 2024
@harshavardhana harshavardhana requested a review from poornas March 17, 2024 09:37
@harshavardhana
Copy link
Member

@poornas can we add a functional test for this?

@harshavardhana harshavardhana merged commit a0de56a into minio:master Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants