A Go package to implement command-line flag parsing.
Questions tagged [go-flag]
20 questions
0
votes
2 answers
Use a space in a flag value in a Golang directive
How do you get spaces in flag values when using directives?
Context
The flag package receives and/or handles flags with spaces differently depending on how Go is called. Quoting the flag value works from the command-line but not with a directive,…

DarkerIvy
- 1,477
- 14
- 26
0
votes
1 answer
how to show current settings only in go-flag package?
I have a project that using package flag to read the argv(parameter), it'll print the default settings when no parameter is given:
func initFlag() {
path := flag.String("F", "store_server.conf", "config file path")
v := flag.Bool("V", false,…

vinllen
- 1,369
- 2
- 18
- 36
0
votes
0 answers
flag.FlagSet.String returning `flag needs an argument:`
cmd is an instance of instance of a *Command struct in the form of:
type Command struct {
Run func(cmd *Command, args []string)
Flag flag.FlagSet
Usage string
Short string
Long string
}
The problem that I am running into is that:
if err…

Pavan Ravipati
- 1,890
- 14
- 21
-1
votes
1 answer
flag redefined: Can two components have same flag variable
I have a deployment with 5 containers.
Among them two of them have --endpoint as argument for which value is set from ENV
So I see this error after deployment
/home/xxx-csi-drivers/xxx-vpc-block-csi-driver flag redefined: endpoint
panic:…

ambikanair
- 4,004
- 11
- 43
- 83
-1
votes
1 answer
How to get Go Flag package to accept a flag name of the form --telemetry.addr
I need to write a piece of code that will take in the arguments "--telemetry.addr=8080" and "--telemetry.path=/metrics", formatted specifically like this.
My code:
package main
import (
"flag"
"fmt"
"net/http"
"os"
…

Trevor Jordy
- 598
- 1
- 7
- 27