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

pkg/pwalk: deprecate in favor of pkg/pwalkdir #185

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

thaJeztah
Copy link
Member

The package was already deprecated in the README, but not in code. This patch marks the code as deprecated, as go1.15 reached EOL, so all consumers should be able to use the new package.

In a follow-up, we can make these functions an alias for the new package (or remove it altogether).

@thaJeztah
Copy link
Member Author

@kolyshkin @mrunalp @rhatdan PTAL

pkg/pwalk/pwalk.go Outdated Show resolved Hide resolved
Comment on lines 46 to 49
return walkN(root, walkFn, num)
}

func walkN(root string, walkFn WalkFunc, num int) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the meaning of this change? Is that for one deprecated function to not use another? In this case perhaps it's easier to annotate instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, both my IDE and linter were complaining about using deprecated functions; so could've either added a //nolint:<xxx> flag, or do this.

I'm wondering though if we perhaps should immediately proceed with aliasing this to the new package, if we're going to support go1.16+ (#183), WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed this back.

w.r.t. aliasing; we can't alias it as the signatures don't match, so let's deprecate it as step 1, then remove after

@thaJeztah thaJeztah force-pushed the deprecate_pkg_pwalk branch from 80fdf9e to 5b239e6 Compare October 6, 2022 09:54
@thaJeztah
Copy link
Member Author

@kolyshkin updated; PTAL

@rhatdan
Copy link
Collaborator

rhatdan commented Oct 6, 2022

LGTM

@thaJeztah
Copy link
Member Author

@rhatdan you need to use GitHub's "approve" now (we're no longer using pullapprove on this repo 😁)

@rhatdan
Copy link
Collaborator

rhatdan commented Oct 7, 2022

/approve

The package was already deprecated in the README, but not in code.
This patch marks the code as deprecated, as go1.15 reached EOL, so
all consumers should be able to use the new package.

In a follow-up, we remove it (after it's been in a release to allow
users to migrate).

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the deprecate_pkg_pwalk branch from 5b239e6 to de26d39 Compare October 7, 2022 20:13
@rhatdan
Copy link
Collaborator

rhatdan commented Oct 10, 2022

@kolyshkin @giuseppe PTAL

@@ -29,6 +33,8 @@ type WalkFunc = filepath.WalkFunc
// - if more than one walkFn instance will return an error, only one
// of such errors will be propagated and returned by Walk, others
// will be silently discarded.
//
// Deprecated: use [github.com/opencontainers/selinux/pkg/pwalkdir.Walk]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Kudos for using doc links!

Nit: missing period at EOL.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me try it again locally, but I think there may have been a bug in Golang's parser; the doc links only work when surrounded by whitespace (to prevent map[string]string being seen as a link), but that also meant that adding a period at the end cause it not to be seen as a link 😞

(Haven't filed an issue for it yet, but did for another one; golang/go#56072)

@@ -38,6 +44,8 @@ func Walk(root string, walkFn WalkFunc) error {
// num walkFn will be called at any one time.
//
// Please see Walk documentation for caveats of using this function.
//
// Deprecated: use [github.com/opencontainers/selinux/pkg/pwalkdir.WalkN]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: missing period at EOL.

Copy link
Collaborator

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

A couple of nits, but since this package is to be removed soon anyway, it doesn't matter much.

LGTM

@kolyshkin kolyshkin merged commit a22d64b into opencontainers:main Oct 10, 2022
@thaJeztah thaJeztah deleted the deprecate_pkg_pwalk branch October 10, 2022 20:21
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