func()

in language/go/config.go [341:412]


func (*goLang) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {
	gc := newGoConfig()
	switch cmd {
	case "fix", "update":
		fs.Var(
			tagsFlag(gc.setBuildTags),
			"build_tags",
			"comma-separated list of build tags. If not specified, Gazelle will not\n\tfilter sources with build constraints.")
		fs.Var(
			&gzflag.ExplicitFlag{Value: &gc.prefix, IsSet: &gc.prefixSet},
			"go_prefix",
			"prefix of import paths in the current workspace")
		fs.Var(
			&externalFlag{&gc.depMode},
			"external",
			"external: resolve external packages with go_repository\n\tvendored: resolve external packages as packages in vendor/")
		fs.Var(
			&gzflag.MultiFlag{Values: &gc.goProtoCompilers, IsSet: &gc.goProtoCompilersSet},
			"go_proto_compiler",
			"go_proto_library compiler to use (may be repeated)")
		fs.Var(
			&gzflag.MultiFlag{Values: &gc.goGrpcCompilers, IsSet: &gc.goGrpcCompilersSet},
			"go_grpc_compiler",
			"go_proto_library compiler to use for gRPC (may be repeated)")
		fs.BoolVar(
			&gc.goRepositoryMode,
			"go_repository_mode",
			false,
			"set when gazelle is invoked by go_repository")
		fs.BoolVar(
			&gc.moduleMode,
			"go_repository_module_mode",
			false,
			"set when gazelle is invoked by go_repository in module mode")
		fs.Var(
			&namingConventionFlag{&gc.goNamingConvention},
			"go_naming_convention",
			"controls generated library names. One of (go_default_library, import, import_alias)")
		fs.Var(
			&namingConventionFlag{&gc.goNamingConventionExternal},
			"go_naming_convention_external",
			"controls naming convention used when resolving libraries in external repositories with unknown conventions")

	case "update-repos":
		fs.StringVar(&gc.buildDirectivesAttr,
			"build_directives",
			"",
			"Sets the build_directives attribute for the generated go_repository rule(s).")
		fs.Var(&gzflag.AllowedStringFlag{Value: &gc.buildExternalAttr, Allowed: validBuildExternalAttr},
			"build_external",
			"Sets the build_external attribute for the generated go_repository rule(s).")
		fs.StringVar(&gc.buildExtraArgsAttr,
			"build_extra_args",
			"",
			"Sets the build_extra_args attribute for the generated go_repository rule(s).")
		fs.Var(&gzflag.AllowedStringFlag{Value: &gc.buildFileGenerationAttr, Allowed: validBuildFileGenerationAttr},
			"build_file_generation",
			"Sets the build_file_generation attribute for the generated go_repository rule(s).")
		fs.StringVar(&gc.buildFileNamesAttr,
			"build_file_names",
			"",
			"Sets the build_file_name attribute for the generated go_repository rule(s).")
		fs.Var(&gzflag.AllowedStringFlag{Value: &gc.buildFileProtoModeAttr, Allowed: validBuildFileProtoModeAttr},
			"build_file_proto_mode",
			"Sets the build_file_proto_mode attribute for the generated go_repository rule(s).")
		fs.StringVar(&gc.buildTagsAttr,
			"build_tags",
			"",
			"Sets the build_tags attribute for the generated go_repository rule(s).")
	}
	c.Exts[goName] = gc
}