apply code review

This commit is contained in:
Antoine Toulme 2023-06-02 00:52:01 -07:00
parent 35657e3262
commit 842e4da755
2 changed files with 2 additions and 11 deletions

View File

@ -30,7 +30,6 @@ func DoSysctrl(mib string) ([]string, error) {
return values, nil
}
// Deprecated: use NumProcsWithContext instead
func NumProcs() (uint64, error) {
return NumProcsWithContext(context.Background())
}

View File

@ -178,11 +178,7 @@ func TestGetEnvWithNoContext(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("windows doesn't have etc")
}
old := os.Getenv("HOST_ETC")
os.Setenv("HOST_ETC", "/bar")
defer func() {
os.Setenv("HOST_ETC", old)
}()
t.Setenv("HOST_ETC", "/bar")
p := HostEtcWithContext(context.Background(), "mtab")
if p != "/bar/mtab" {
t.Errorf("invalid HostEtc, %s", p)
@ -193,11 +189,7 @@ func TestGetEnvWithContextOverride(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("windows doesn't have etc")
}
old := os.Getenv("HOST_ETC")
os.Setenv("HOST_ETC", "/bar")
defer func() {
os.Setenv("HOST_ETC", old)
}()
t.Setenv("HOST_ETC", "/bar")
ctx := context.WithValue(context.Background(), common.EnvKey, common.EnvMap{common.HostEtcEnvKey: "/foo"})
p := HostEtcWithContext(ctx, "mtab")
if p != "/foo/mtab" {