Source file src/cmd/go/internal/modload/stat_windows.go

     1  // Copyright 2019 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  //go:build windows
     6  
     7  package modload
     8  
     9  import "io/fs"
    10  
    11  // hasWritePerm reports whether the current user has permission to write to the
    12  // file with the given info.
    13  func hasWritePerm(_ string, fi fs.FileInfo) bool {
    14  	// Windows has a read-only attribute independent of ACLs, so use that to
    15  	// determine whether the file is intended to be overwritten.
    16  	//
    17  	// Per https://golang.org/pkg/os/#Chmod:
    18  	// “On Windows, only the 0200 bit (owner writable) of mode is used; it
    19  	// controls whether the file's read-only attribute is set or cleared.”
    20  	return fi.Mode()&0200 != 0
    21  }
    22  

View as plain text