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

Upgrade dependencies to latest versions #387

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

prskr
Copy link
Contributor

@prskr prskr commented Dec 1, 2021

Some of the dependencies are already one or multiple major versions behind upstream.
For instance gopkg.in/yaml.v2 in the previous version is known to be vulnerable.

Also github.com/Flaque/filet can easily be replaced with functions from the standard library and github.com/pkg/errors is an archived project and replaced with Go 1.13 error extensions.

To get rid of at least as many warnings GoLand reports as possible I made all error ignores explicit where they weren't in a defer call. The remaining ones could be replaced - at least in test cases - with a neat helper method?

docker_test.go Outdated
defer func() {
os.Setenv("HOME", oldHome)
}()
tmpDir := t.TempDir()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Neat!

oldHome := os.Getenv("HOME")
os.Unsetenv("HOME")
defer func() {
os.Setenv("HOME", oldHome)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it required to avoid resetting the env to previous value of the HOME variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, according to the docs that's automatically done after the test is completed

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 just saw this is brand new in Go 1.17 😅 shall I revert it or is it okay to update the test environment?
I don't expect this to break compatibility for the library itself but I'm not sure about 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 replaced the 'fancy' standard lib calls with gotest.tools pendants to get compatibility with Go 1.14 again. The dependency was already in place and this way I still can remove filet and the env is automatically managed 😊

@prskr prskr force-pushed the update-deps branch 2 times, most recently from 0e02a18 to 2b47886 Compare December 6, 2021 16:29
- apply major upgrades for gopkg.in/yaml, gotest.tools and github.com/cenkalti/backoff
- get rid of obsolete github.com/pkg/errors
- replace github.com/Flaque/filet with standard library
- make error ignores explicit where possible
@prskr
Copy link
Contributor Author

prskr commented Dec 20, 2021

@mdelapenya sorry, hat to rebase it once more to switch back to ioutil.WriteFile instead of os.WriteFile to be compatible with Go 1.13 🙈

@mdelapenya mdelapenya added the chore Changes that do not impact the existing functionality label Dec 20, 2021
Copy link
Collaborator

@gianarb gianarb left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this! Let's get it checked in!

@gianarb gianarb merged commit 6b77020 into testcontainers:master Dec 20, 2021
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