System Grab Bag

View all TLDR pages from common (or from all pages)

gofmt

Tool for formatting Go source code. More information: https://golang.org/cmd/gofmt/.
  • Format a file and display the result to the console:
    gofmt {{source.go}}
  • Format a file, overwriting the original file in-place:
    gofmt -w {{source.go}}
  • Format a file, and then simplify the code, overwriting the original file:
    gofmt -s -w {{source.go}}
  • Print all (including spurious) errors:
    gofmt -e {{source.go}}

License and Disclaimer

The content on this page is copyright © 2014—present the tldr-pages team and contributors.
This page is used with permission under Creative Commons Attribution 4.0 International License.

While we do attempt to make sure content is accurate, there isn't a warranty of any kind.