github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/go/internal/fmtcmd/fmt.go (about) 1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package fmtcmd implements the “go fmt” command. 6 package fmtcmd 7 8 import ( 9 "github.com/shogo82148/std/cmd/go/internal/base" 10 ) 11 12 var CmdFmt = &base.Command{ 13 Run: runFmt, 14 UsageLine: "go fmt [-n] [-x] [packages]", 15 Short: "gofmt (reformat) package sources", 16 Long: ` 17 Fmt runs the command 'gofmt -l -w' on the packages named 18 by the import paths. It prints the names of the files that are modified. 19 20 For more about gofmt, see 'go doc cmd/gofmt'. 21 For more about specifying packages, see 'go help packages'. 22 23 The -n flag prints commands that would be executed. 24 The -x flag prints commands as they are executed. 25 26 The -mod flag's value sets which module download mode 27 to use: readonly or vendor. See 'go help modules' for more. 28 29 To run gofmt with specific options, run gofmt itself. 30 31 See also: go fix, go vet. 32 `, 33 }