apply code review
This commit is contained in:
parent
35657e3262
commit
842e4da755
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -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" {
|
||||
|
|
Loading…
Reference in New Issue