Source file src/os/example_windows_test.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package os_test
     6  
     7  import (
     8  	"errors"
     9  	"syscall"
    10  )
    11  
    12  // isOSSymlinkUnsupportedError returns true when err is an error
    13  // returned by os.Symlink when symlinks are unsupported by OS.
    14  func isOSSymlinkUnsupportedError(err error) bool {
    15  	return errors.Is(err, errors.ErrUnsupported) ||
    16  		errors.Is(err, syscall.EWINDOWS) ||
    17  		errors.Is(err, syscall.ERROR_PRIVILEGE_NOT_HELD)
    18  }
    19  

View as plain text