21 lines
298 B
Go
21 lines
298 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) != 2 {
|
|
fmt.Fprintf(os.Stderr, "usage: access <path>\n")
|
|
os.Exit(1)
|
|
}
|
|
|
|
filename := os.Args[1]
|
|
if err := unix.Access(filename, unix.W_OK); err != nil {
|
|
fmt.Printf("%v: %v\n", filename, err)
|
|
}
|
|
}
|