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

[release/1.7 backport] Revert "log: define G() as a function instead of a variable" #9032

Merged

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Aug 30, 2023

This reverts commit 778ac30.

(slightly modified, due to changes that were merged after that).

The reverted commit had two elements;

  • Make G an actual function to improve the documentation
  • Prevent G from being overwritten externally

From the commit that's reverted:

The G variable is exported, and not expected to be overwritten
externally. Defining it as a function also documents it as a function
on https://pkg.go.dev, instead of a variable; https://pkg.go.dev/github.com/containerd/containerd@v1.6.22/log#pkg-variables

While it's unclear if the ability to replace the implementation was intentional, it's this part that some external consumers were (ab)using.

We should look into that part in a follow-up, and design for this, for example by providing a utility to replace the logger, and properly document that.

In the meantime, let's revert the change.

(cherry picked from commit 19d6c37)

This reverts commit 778ac30.

(slightly modified, due to changes that were merged after that).

The reverted commit had two elements;

- Make `G` an actual function to improve the documentation
- Prevent `G` from being overwritten externally

From the commit that's reverted:

> The `G` variable is exported, and not expected to be overwritten
> externally. Defining it as a function also documents it as a function
> on https://pkg.go.dev, instead of a variable; https://pkg.go.dev/github.com/containerd/containerd@v1.6.22/log#pkg-variables

While it's unclear if the ability to replace the implementation was
_intentional_, it's this part that some external consumers were (ab)using.

We should look into that part in a follow-up, and design for this, for
example by providing a utility to replace the logger, and properly document
that.

In the meantime, let's revert the change.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 19d6c37)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
neersighted added a commit to neersighted/moby that referenced this pull request Aug 30, 2023
FIXME: `replace` with containerd/containerd#9032
to work around a logging API regression in v1.7.5.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
neersighted added a commit to neersighted/moby that referenced this pull request Aug 30, 2023
FIXME: `replace` with containerd/containerd#9032
to work around a logging API regression in v1.7.5.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
@k8s-ci-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@dmcgowan dmcgowan marked this pull request as ready for review August 31, 2023 13:56
@estesp estesp merged commit c2978c2 into containerd:release/1.7 Aug 31, 2023
49 checks passed
@thaJeztah thaJeztah deleted the 1.7_backport_revert_log_var branch August 31, 2023 14:50
neersighted added a commit to neersighted/moby that referenced this pull request Sep 6, 2023
FIXME: `replace` with containerd/containerd#9032
to work around a logging API regression in v1.7.5.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
neersighted added a commit to neersighted/moby that referenced this pull request Sep 7, 2023
FIXME: `replace` with containerd/containerd#9032
to work around a logging API regression in v1.7.5.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
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.

None yet

5 participants