While gofmt formats individual files, go fmt formats entire packages. Run go fmt in your project directory to format all Go files at once.
Most code editors can run go fmt automatically when you save a file. Set this up early. It saves time and ensures your code is always formatted correctly. Search your editor's settings for "format on save" and enable it for Go files.