Skip to content

Revert "log: define G() as a function instead of a variable"#9031

Merged
dmcgowan merged 1 commit intocontainerd:mainfrom
thaJeztah:revert_log_var
Aug 31, 2023
Merged

Revert "log: define G() as a function instead of a variable"#9031
dmcgowan merged 1 commit intocontainerd:mainfrom
thaJeztah:revert_log_var

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

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/[email protected]/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.

@thaJeztah

This comment was marked as resolved.

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/[email protected]/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 <[email protected]>
Copy link
Copy Markdown
Contributor

@neersighted neersighted left a comment

Choose a reason for hiding this comment

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

Tested and fixes BuildKit 0.12 with containerd 1.7 at moby/moby#45966.

@thaJeztah thaJeztah added cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch and removed cherry-pick/1.7.x Change to be cherry picked to release/1.7 branch labels Aug 30, 2023
@dmcgowan dmcgowan merged commit b2f4646 into containerd:main Aug 31, 2023
@thaJeztah thaJeztah deleted the revert_log_var branch August 31, 2023 14:16
@thaJeztah thaJeztah added cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch and removed cherry-pick/1.6.x labels Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants