mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 22:13:39 +00:00
os: Drop support for go 1.15
1.15 specific files deleted. 1.16 specific files folded carefully into generic files, with goal of reducing diff with upstream. Follows upstream 1.16 in making PathError etc. be aliases for the same errors in io/fs. This fixes #2817 and lets us add io/ioutil to "make test-tinygo" on linux and mac.
This commit is contained in:
+20
-6
@@ -1,21 +1,32 @@
|
||||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package os
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/fs"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Portable analogs of some common system call errors.
|
||||
//
|
||||
// Errors returned from this package may be tested against these errors
|
||||
// with errors.Is.
|
||||
var (
|
||||
ErrInvalid = errors.New("invalid argument")
|
||||
ErrPermission = errors.New("permission denied")
|
||||
ErrClosed = errors.New("file already closed")
|
||||
// ErrInvalid indicates an invalid argument.
|
||||
// Methods on File will return this error when the receiver is nil.
|
||||
ErrInvalid = fs.ErrInvalid // "invalid argument"
|
||||
|
||||
ErrPermission = fs.ErrPermission // "permission denied"
|
||||
ErrExist = fs.ErrExist // "file already exists"
|
||||
ErrNotExist = fs.ErrNotExist // "file does not exist"
|
||||
ErrClosed = fs.ErrClosed // "file already closed"
|
||||
|
||||
// Portable analogs of some common system call errors.
|
||||
// Note that these are exported for use in the Filesystem interface.
|
||||
ErrUnsupported = errors.New("operation not supported")
|
||||
ErrNotImplemented = errors.New("operation not implemented")
|
||||
ErrNotExist = errors.New("file not found")
|
||||
ErrExist = errors.New("file exists")
|
||||
)
|
||||
|
||||
// The following code is copied from the official implementation.
|
||||
@@ -46,6 +57,9 @@ func NewSyscallError(syscall string, err error) error {
|
||||
return &SyscallError{syscall, err}
|
||||
}
|
||||
|
||||
// PathError records an error and the operation and file path that caused it.
|
||||
type PathError = fs.PathError
|
||||
|
||||
// SyscallError records an error from a specific system call.
|
||||
type SyscallError struct {
|
||||
Syscall string
|
||||
|
||||
Reference in New Issue
Block a user