我目前運行的是 64 位 Windows 8,我正在嘗試創建一個日志文件以與 Web 服務器一起使用。有問題的代碼是:func LogWebPath(requestedURL string, accessedURL string, logFile string) error {file, _ := os.Open(logFile)_, err = io.WriteString(file, requestedURL + ":" + accessedURL)if(err != nil) { fmt.Println(err) return err}file.Close()return errors.New("nil")}每當 io.WriteString 被調用時,返回的錯誤是 write log/visit.log: Access is denied.我的系統上安裝了 Go,我正在使用它go run x.go來運行我的 Go 源代碼。
Golang 嘗試使用 io.WriteString 寫入文件時出現“訪問被拒絕”錯誤
幕布斯6054654
2021-11-01 11:03:49