文件操作 - error_linux_test.go
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/go-1.23/src/internal/poll/error_linux_test.go
编辑文件内容
// Copyright 2019 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 poll_test import ( "errors" "internal/poll" "os" "syscall" ) func badStateFile() (*os.File, error) { if os.Getuid() != 0 { return nil, errors.New("must be root") } // Using OpenFile for a device file is an easy way to make a // file attached to the runtime-integrated network poller and // configured in halfway. return os.OpenFile("/dev/net/tun", os.O_RDWR, 0) } func isBadStateFileError(err error) (string, bool) { switch err { case poll.ErrNotPollable, syscall.EBADFD: return "", true default: return "not pollable or file in bad state error", false } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件