Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/internal/modload

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

View as plain text