Skip to content

cmd/go/internal/lockedfile: ignore errors if locks are not supported #42994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func unlock(f File) error {

func isNotSupported(err error) bool {
switch err {
case windows.ERROR_NOT_SUPPORTED, windows.ERROR_CALL_NOT_IMPLEMENTED, ErrNotSupported:
case windows.ERROR_INVALID_FUNCTION, windows.ERROR_NOT_SUPPORTED, windows.ERROR_CALL_NOT_IMPLEMENTED, ErrNotSupported:
return true
default:
return false
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/internal/lockedfile/lockedfile_filelock.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func openFile(name string, flag int, perm fs.FileMode) (*os.File, error) {
default:
err = filelock.RLock(f)
}
if err != nil {
if err != nil && !filelock.IsNotSupported(err) {
f.Close()
return nil, err
}
Expand Down
1 change: 1 addition & 0 deletions src/internal/syscall/windows/syscall_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func UTF16PtrToString(p *uint16) string {
}

const (
ERROR_INVALID_FUNCTION syscall.Errno = 1
ERROR_SHARING_VIOLATION syscall.Errno = 32
ERROR_LOCK_VIOLATION syscall.Errno = 33
ERROR_NOT_SUPPORTED syscall.Errno = 50
Expand Down