Skip to content

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

Merged
kolyshkin merged 1 commit intoopencontainers:mainfrom
thaJeztah:deprecate_pkg_pwalk
Oct 10, 2022
Merged

pkg/pwalk: deprecate in favor of pkg/pwalkdir#185
kolyshkin merged 1 commit intoopencontainers:mainfrom
thaJeztah:deprecate_pkg_pwalk

Conversation

@thaJeztah
Copy link
Copy Markdown
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
Copy Markdown
Member Author

@kolyshkin @mrunalp @rhatdan PTAL

Comment on lines +46 to +49
return walkN(root, walkFn, num)
}

func walkN(root string, walkFn WalkFunc, num int) error {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

@kolyshkin updated; PTAL

@rhatdan
Copy link
Copy Markdown
Collaborator

rhatdan commented Oct 6, 2022

LGTM

@thaJeztah
Copy link
Copy Markdown
Member Author

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

@rhatdan
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

rhatdan commented Oct 10, 2022

@kolyshkin @giuseppe PTAL

// 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
Copy Markdown
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
Copy Markdown
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)

//
// Please see Walk documentation for caveats of using this function.
//
// Deprecated: use [github.com/opencontainers/selinux/pkg/pwalkdir.WalkN]
Copy link
Copy Markdown
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
Copy Markdown
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