From d8f9c4c1ac0bb170f72857f67e0b8fd18904daa1 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Thu, 24 Oct 2024 17:41:43 +0200 Subject: [PATCH] os: don't check for developer mode in TestSymlinkCreation testenv.HasSymlink is already smart enough to return false if the process is not elevated or developer mode is not enabled. There is no need to check it twice. Change-Id: Ib26c1509058230b07dbf5f2c808a10ae731f4ae4 Reviewed-on: https://go-review.googlesource.com/c/go/+/622156 Auto-Submit: Quim Muntal Reviewed-by: Michael Pratt LUCI-TryBot-Result: Go LUCI Reviewed-by: Alex Brainman Reviewed-by: Carlos Amedee --- src/os/os_windows_test.go | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/os/os_windows_test.go b/src/os/os_windows_test.go index d9c8fe3db9..591798e9c0 100644 --- a/src/os/os_windows_test.go +++ b/src/os/os_windows_test.go @@ -1017,8 +1017,8 @@ func TestStatNUL(t *testing.T) { // works on Windows when developer mode is active. // This is supported starting Windows 10 (1703, v10.0.14972). func TestSymlinkCreation(t *testing.T) { - if !testenv.HasSymlink() && !isWindowsDeveloperModeActive() { - t.Skip("Windows developer mode is not active") + if !testenv.HasSymlink() { + t.Skip("skipping test; no symlink support") } t.Parallel() @@ -1034,23 +1034,6 @@ func TestSymlinkCreation(t *testing.T) { } } -// isWindowsDeveloperModeActive checks whether or not the developer mode is active on Windows 10. -// Returns false for prior Windows versions. -// see https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development -func isWindowsDeveloperModeActive() bool { - key, err := registry.OpenKey(registry.LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AppModelUnlock", registry.READ) - if err != nil { - return false - } - - val, _, err := key.GetIntegerValue("AllowDevelopmentWithoutDevLicense") - if err != nil { - return false - } - - return val != 0 -} - // TestRootRelativeDirSymlink verifies that symlinks to paths relative to the // drive root (beginning with "\" but no volume name) are created with the // correct symlink type. -- 2.48.1