Skip to content

osutil: remove unused Unsetenv function #16787

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

Merged
merged 1 commit into from
Nov 4, 2023
Merged

osutil: remove unused Unsetenv function #16787

merged 1 commit into from
Nov 4, 2023

Conversation

evanj
Copy link
Contributor

@evanj evanj commented Oct 17, 2023

The osutil.Unsetenv function is not used. Today, os.Unsetenv exists in the standard library, and is already used elsewhere in etcd. Removing this function could break things that may be importing this package. According to pkg.go.dev, it seems like the only thing is etcd forks, so it may be worth getting rid of this code. See:

https://pkg.go.dev/github.com/coreos/etcd/pkg/osutil?tab=importedby

Signed-off-by: Evan Jones [email protected]

The osutil.Unsetenv function is not used. Today, os.Unsetenv exists
in the standard library, and is already used elsewhere in etcd.
Removing this function could break things that may be importing this
package. According to pkg.go.dev, it seems like the only thing is
etcd forks, so it may be worth getting rid of this code. See:

https://pkg.go.dev/github.com/coreos/etcd/pkg/osutil?tab=importedby

Signed-off-by: Evan Jones <[email protected]>
@evanj
Copy link
Contributor Author

evanj commented Oct 17, 2023

Feel free to reject this change. I noticed this while looking for things that may be calling os.Setenv due to golang/go#63567 ; I figured removing this would probably make sense. This is just a clean up that shouldn't do anything.

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

The go stdlib os.Unsetenv can cover this.

Copy link
Member

@jmhbnz jmhbnz left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks @evanj

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

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

It's a public function. It might be used by applications.

But why does etcd have to implement such public function? Especially it has already been supported by https://pkg.go.dev/os#Unsetenv.

I agree to remove it anyway.

@jmhbnz
Copy link
Member

jmhbnz commented Nov 4, 2023

Hey @ahrtr - Had a quick scan on GitHub and I can't see any meaningful references to osutil.unsetEnv: https://github.com/search?q=osutil.unsetEnv&type=code

Of course someone could be renaming the import package but I think the risk would be low and the OP has also checked pkg.go.dev which only showed etcd forks. With two reviewer approvals and one maintainer approval are we ok to merge this for main?

@ahrtr
Copy link
Member

ahrtr commented Nov 4, 2023

With two reviewer approvals and one maintainer approval are we ok to merge this for main?

OK, merging... thx

@ahrtr ahrtr merged commit d38f7dc into etcd-io:main Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants