internal/godebug: remove dependency on os

The immediate reason is that we want to use godebug from math/rand,
and math/rand importing godebug importing os causes an import cycle
in package testing.

More generally, the new approach to backward compatibility outlined
in discussion #55090 will require using this package from other similarly
sensitive places, perhaps even package os itself. Best to remove all
dependencies.

Preparation for #54880.

Change-Id: Ia01657a2d90e707a8121a336c9db3b7247c0198f
Reviewed-on: https://go-review.googlesource.com/c/go/+/439418
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Russ Cox 2022-10-17 15:34:50 -04:00 committed by Gopher Robot
parent 9fedc481ea
commit 8dc08394f0
10 changed files with 72 additions and 28 deletions

View file

@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package godebug
package godebug_test
import "testing"
import (
. "internal/godebug"
"testing"
)
func TestGet(t *testing.T) {
tests := []struct {
@ -26,7 +29,7 @@ func TestGet(t *testing.T) {
{"foo=bar,baz", "loooooooong", ""},
}
for _, tt := range tests {
got := get(tt.godebug, tt.key)
got := Xget(tt.godebug, tt.key)
if got != tt.want {
t.Errorf("get(%q, %q) = %q; want %q", tt.godebug, tt.key, got, tt.want)
}