-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed as not planned
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.
Description
Go version
any version
Output of go env in your module/workspace:
defaultWhat did you do?
package main
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
)
func syncDir(dir string) error {
dirF, err := os.Open(dir)
if err != nil {
return fmt.Errorf("failed to open dir %s: %w", dir, err)
}
err = dirF.Sync()
dirF.Close()
if err != nil {
return fmt.Errorf("failed to sync dir %s: %w", dir, err)
}
return nil
}
func main() {
targetDir := "C:\\data\\logs"
targetFile := filepath.Join(targetDir, "output.txt")
if err := os.MkdirAll(targetDir, 0755); err != nil {
panic(err)
}
content := "This is a test string"
if err := ioutil.WriteFile(targetFile, []byte(content), 0644); err != nil {
panic(err)
}
if err := syncDir(filepath.Dir(targetDir)); err != nil {
fmt.Println(err)
}
}
will show error Access is denied.
What did you see happen?
will show error Access is denied.
What did you expect to see?
run successful.
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.