update code for compatibility with Go 1.27

Fix some test expectations and also fix the production code in
impersonator.go to make them compatible with both Go 1.27 and also
with older versions, e.g. Go 1.26. With these changes, all unit
tests pass when run with either Go 1.26 or Go 1.27.

Signed-off-by: Ryan Richard <richardry@vmware.com>
This commit is contained in:
Ryan Richard
2026-08-28 11:45:56 -07:00
parent 74f422a2d9
commit f81d65bcb7
5 changed files with 94 additions and 4 deletions
+4 -1
View File
@@ -615,8 +615,11 @@ func TestPlog(t *testing.T) {
case runtimeVersionSemver.Major == 1 && runtimeVersionSemver.Minor == 21:
// Format of string for Go 1.21
return "func13.TestPlog.func13.1.func2"
case runtimeVersionSemver.Major == 1 && runtimeVersionSemver.Minor >= 27:
// Format of string for Go 1.27+
return "func13.1.1"
case runtimeVersionSemver.Major == 1 && runtimeVersionSemver.Minor >= 22:
// Format of string for Go 1.22+
// Format of string for Go 1.22 - 1.26
return "func13.TestPlog.func13.1.2"
default:
// Format of string for Go 1.20 and below.