Closed
Description
Documentation specifies that gofmt ignores dotfiles but go fmt
will still pass them as arguments to gofmt. For example (Go 1.7.3)
-> ᛯ echo package main >main.go
-> ᛯ strace -f gofmt . 2>&1 |grep nope
[pid 7607] lstat(".nope.go", {st_mode=S_IFREG|0644, st_size=13, ...}) = 0
-> ᛯ strace -f go fmt 2>&1 |grep nope
[pid 8013] lstat("/tmp/asd/.nope.go", {st_mode=S_IFREG|0644, st_size=13, ...}) = 0
[pid 8029] execve("/usr/lib/go-1.7/bin/gofmt", ["/usr/lib/go-1.7/bin/gofmt", "-l", "-w", ".nope.go", "main.go"], [/* 64 vars */] <unfinished ...>
[pid 8029] stat(".nope.go", <unfinished ...>
[pid 8029] openat(AT_FDCWD, ".nope.go", O_RDONLY|O_CLOEXEC <unfinished ...>
[pid 8029] read(3, "package nope\n", 512) = 13
some editors like emacs create symliks as locks for modified files like that: .#wifitoken.go -> [email protected]:1482232478
and that causes go fmt
to spew errors:
-> ᛯ go fmt
stat .#wifitoken.go: no such file or directory
exit status 2
which could also be avoided if go fmt
correctly ignored files