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

feat: add golangci-lint #48

Merged
merged 1 commit into from Nov 21, 2022
Merged

Conversation

hhsnopek
Copy link
Contributor

Context

This pull request introduces golangci-lint into the existing CI/CD Pipeline to increase the project's code health. Applying go fmt to all files and fixes a lot of missing error handling.

main.go Outdated Show resolved Hide resolved
main.go Outdated
cli.ContainerRemove(context.Background(), container.ID, types.ContainerRemoveOptions{RemoveVolumes: true, Force: true})
err := cli.ContainerRemove(context.Background(), container.ID, types.ContainerRemoveOptions{RemoveVolumes: true, Force: true})
if err != nil {
log.Println(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to continue here to avoid incrementing the number of deleted containers?

Copy link
Member

@kiview kiview Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am nitpicking, I would probably add this in a follow-up bugfix PR, to have a slightly better Git history and keep this PR here focused on the linting change 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmm I think it is actually part of the change: handle the error, which was not handled in the past

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which number of deleted containers we would have before? Probably no output, since it would fail? Or we would have the wrong number?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error was swallowed, the execution continued adding a container to the map.

Being strict, it could be considered a fix, yeah

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we can also be pragmatic and fix it here. I think having the discussion was more important than the detail where we fix it (as long as we fix it).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure what the expected functionality should be at this time, happy to discuss it further in another PR as there are a handful of unhandled errors.

Copy link
Contributor

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although we left a a few comments that need to be addressed before the final approval.

Could you please also resolve the conflicts after recent merges?

Thanks for your time @hhsnopek!

@hhsnopek
Copy link
Contributor Author

@mdelapenya @kiview I apologize for the force push, but I've resolved the comments which means I've removed the additional error handling/logs in-favor of keeping the scope to adding golangci-lint.

@hhsnopek hhsnopek requested review from mdelapenya and kiview and removed request for mdelapenya and kiview November 20, 2022 23:12
@mdelapenya mdelapenya self-assigned this Nov 21, 2022
@mdelapenya mdelapenya merged commit 8f512d3 into testcontainers:main Nov 21, 2022
@hhsnopek hhsnopek deleted the golangci-lint branch November 21, 2022 16:49
@mdelapenya mdelapenya added the chore Changes that do not impact the existing functionality label Nov 29, 2022
mdelapenya added a commit to gesellix/moby-ryuk that referenced this pull request Dec 1, 2022
* main:
  feat: add golangci-lint (testcontainers#48)
  chore: add unit tests for Prune function (testcontainers#46)
  chore(ci): only push Docker image on tags (testcontainers#47)
  chore: bump build system versions (testcontainers#45)
  chore: rename branch to main (testcontainers#44)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Changes that do not impact the existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants