Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

gopherbot opened this issue May 24, 2014 · 4 comments

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

gopherbot opened this issue May 24, 2014 · 4 comments


Copy link

@gopherbot gopherbot commented May 24, 2014


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.
Copy link

@cznic cznic commented May 25, 2014

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.
Copy link

@gopherbot gopherbot commented May 26, 2014

Comment 2 by onsijoe:

Yes, but go fmt doesn't support rewrite rules... which is the usecase I'm struggling
Copy link

@griesemer griesemer commented Sep 10, 2014

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.

Copy link

@griesemer griesemer commented Oct 1, 2014

Comment 4:

Owner changed to @griesemer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.