{"record":{"id":"28fb75762713fce5","repo":"golang/go","slug":"parse-error","errorCode":null,"errorMessage":"parse error","messagePattern":"parse error","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cmd/go/internal/modget/get.go","lineNumber":261,"sourceCode":"}\n\nfunc (v *upgradeFlag) String() string { return \"\" }\n\n// dFlag is a custom flag.Value for the deprecated -d flag\n// which will be used to provide warnings or errors if -d\n// is provided.\ntype dFlag struct {\n\tvalue bool\n\tset   bool\n}\n\nfunc (v *dFlag) IsBoolFlag() bool { return true }\n\nfunc (v *dFlag) Set(s string) error {\n\tv.set = true\n\tvalue, err := strconv.ParseBool(s)\n\tif err != nil {\n\t\terr = errors.New(\"parse error\")\n\t}\n\tv.value = value\n\treturn err\n}\n\nfunc (b *dFlag) String() string { return \"\" }\n\nfunc init() {\n\twork.AddBuildFlags(CmdGet, work.OmitModFlag)\n\tCmdGet.Run = runGet // break init loop\n\tCmdGet.Flag.Var(&getD, \"d\", \"deprecated flag; is a no-op\")\n\tCmdGet.Flag.Var(&getU, \"u\", \"update modules providing dependencies to use newer minor or patch releases when available; -u=patch selects patch releases\")\n}\n\nfunc runGet(ctx context.Context, cmd *base.Command, args []string) {\n\tmoduleLoader := modload.NewLoader()\n\tswitch getU.version {\n\tcase \"\", \"upgrade\", \"patch\":","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modget/get.go#L243-L279","documentation":"The deprecated -d flag on `go get` is a boolean flag whose Set calls strconv.ParseBool. If the supplied value cannot be parsed (ParseBool only accepts 1,t,T,TRUE,true,True,0,f,F,FALSE,false,False), Set returns \"parse error\" and flag parsing fails.","triggerScenarios":"Invoking `go get -d=<unparseable>` where the value is something like `-d=on`, `-d=yes`, or `-d=enable`.","commonSituations":"Scripts copy-pasted from documentation that used a non-bool; automation translating generic on/off flags to -d; misunderstanding the deprecated flag's accepted values.","solutions":["Drop the -d flag entirely; it is deprecated and a no-op in modern go.","If you must set it, use a value strconv.ParseBool accepts: `-d=true` or `-d=false`."],"exampleFix":"// before\n//   go get -d=on example.com/foo\n// after\n//   go get example.com/foo      // -d removed (deprecated no-op)","handlingStrategy":"validation","validationCode":"// Validate the flag value before passing it to `go get -d=`:\n//   if _, err := strconv.ParseBool(v); err != nil {\n//     // reject; or just drop the deprecated -d flag entirely\n//   }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remove the deprecated -d flag from scripts and documentation.","Only pass values strconv.ParseBool accepts (true/false/1/0/t/f)."],"tags":["go","go-get","flags","deprecated"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}