Skip to content

Modernize Go code#559

Merged
jnovy merged 6 commits intocontainers:mainfrom
kolyshkin:no-pkg-errors
May 2, 2025
Merged

Modernize Go code#559
jnovy merged 6 commits intocontainers:mainfrom
kolyshkin:no-pkg-errors

Conversation

@kolyshkin
Copy link
Collaborator

This fixes a few minor issues with go code in this repo:

  • stop using unmaintained pkg/errors (in favor of standard Go error wrapping);
  • stop using deprecated io/ioutil;
  • remove unused code and data;
  • format octal numbers with 0o prefix.

The github.com/pkg/errors is frozen since November 2021, and %w for
fmt.Errorf is available since Go 1.13 (September 2019).

Switch from pkg/errors to Go native way of wrapping errors.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The io/ioutil package is deprecated since Go 1.16,
so let's switch to os for ReadFile and WriteFile.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The testing.TempDir function is available since Go 1.15.

Since tests are written using ginkgo, use GinkgoT to obtain
*testing.T.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This was introduced in commit 31c5a2e ("add tests running a runtime")
but was not used ever.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Probably a leftover from developing tests.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Apparently the code is well formatted, except for 0oNNN for octal
numbers (available since Go 1.13).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@haircommander
Copy link
Collaborator

LGTM

@jnovy
Copy link
Collaborator

jnovy commented May 2, 2025

LGTM too, thanks for this Kir!

@jnovy jnovy merged commit ecf16be into containers:main May 2, 2025
29 checks passed
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