Skip to content

Commit

Permalink
apply code review
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Jun 2, 2023
1 parent 346191b commit f0f6b14
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
1 change: 0 additions & 1 deletion internal/common/common_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
12 changes: 2 additions & 10 deletions internal/common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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" {
Expand Down

0 comments on commit f0f6b14

Please sign in to comment.