golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.87k stars 17.52k forks source link

cmd/gofmt: gofmt doesn't ignore directories prefixed with _ #8091

Open gopherbot opened 10 years ago

gopherbot commented 10 years ago

by onsi@pivotallabs.com:

go test ./... ignores directories prefixed with _.  This is convenient and seems like a
reasonable rule of thumb.

gofmt -w . 

does *not* honor this "rule"

With the ascendance of Godeps there are now Godeps/_workspace folders vendoring
dependencies all over the place.  Having gofmt -w . rewrite my dependencies is painful. 
Any change the "ignore _" rule could be ported over to gofmt sometime soon? 
Would be happy to work on a pull request for this.
cznic commented 10 years ago

Comment 1:

gofmt is not part of the go tool and the desired behavior of the go tool is nowhere
specified to apply to gofmt. Use instead, for example,
        $ go fmt ./...
It works as expected, ie. it ignores directories starting with the underscore character.
#WAI
gopherbot commented 10 years ago

Comment 2 by onsijoe:

Yes, but go fmt doesn't support rewrite rules... which is the usecase I'm struggling
with.
griesemer commented 10 years ago

Comment 3:

This is a feature request for gofmt, not go fmt.
This is not urgent since it's easy to apply gofmt selectively to a list of files
(possibly created using Unix find and friends).

Labels changed: added release-none, repo-main.

Status changed to Thinking.

griesemer commented 9 years ago

Comment 4:

Owner changed to @griesemer.