src/pkg/os/error_posix.go - The Go Programming Language

Golang

Source file src/pkg/os/error_posix.go

     1	// Copyright 2009 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	// +build darwin freebsd linux netbsd openbsd
     6	
     7	package os
     8	
     9	import "syscall"
    10	
    11	func isExist(err error) bool {
    12		if pe, ok := err.(*PathError); ok {
    13			err = pe.Err
    14		}
    15		return err == syscall.EEXIST || err == ErrExist
    16	}
    17	
    18	func isNotExist(err error) bool {
    19		if pe, ok := err.(*PathError); ok {
    20			err = pe.Err
    21		}
    22		return err == syscall.ENOENT || err == ErrNotExist
    23	}
    24	
    25	func isPermission(err error) bool {
    26		if pe, ok := err.(*PathError); ok {
    27			err = pe.Err
    28		}
    29		return err == syscall.EACCES || err == syscall.EPERM || err == ErrPermission
    30	}