Go fmt on a whole source tree

前端 未结 6 891
借酒劲吻你
借酒劲吻你 2021-01-30 03:36

I have a project currently organized something like this:

~/code/go
         /bin
         /pkg
         /src
             /proj/main.go
                  /some_packa         


        
6条回答
  •  旧巷少年郎
    2021-01-30 04:31

    You can use three dots (...) as a wildcard. So for example, the following command will format all github.com packages:

    go fmt github.com/...
    

    This wildcard also works with other go commands like go list, go get and so. There is no need to remember such an ugly find command.

提交回复
热议问题