// The -n flag prints commands that would be executed.
// The -x flag prints commands as they are executed.
//
+// The -mod flag's value sets which module download mode
+// to use: readonly or vendor. See 'go help modules' for more.
+//
// To run gofmt with specific options, run gofmt itself.
//
// See also: go fix, go vet.
flags.BoolVar(&cfg.BuildN, "n", false, "")
flags.BoolVar(&cfg.BuildX, "x", false, "")
}
+
+// AddLoadFlags adds the -mod build flag to the flag set.
+func AddLoadFlags(flags *flag.FlagSet) {
+ flags.StringVar(&cfg.BuildMod, "mod", "", "")
+}
func init() {
base.AddBuildFlagsNX(&CmdFmt.Flag)
+ base.AddLoadFlags(&CmdFmt.Flag)
}
var CmdFmt = &base.Command{
The -n flag prints commands that would be executed.
The -x flag prints commands as they are executed.
+The -mod flag's value sets which module download mode
+to use: readonly or vendor. See 'go help modules' for more.
+
To run gofmt with specific options, run gofmt itself.
See also: go fix, go vet.
go build -mod=vendor
go test -mod=vendor . ./subdir
go test -mod=vendor ./...
+go fmt -mod=vendor ./...
-- go.mod --
module m