My urfave/cli version is
v3.6.2
Checklist
Dependency Management
- My project is using go modules.
Describe the bug
The flag option Local changes the behavior of StringSliceFlag.
To reproduce
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/urfave/cli/v3"
)
func main() {
app := &cli.Command{
Name: "foo",
Action: func(ctx context.Context, cmd *cli.Command) error {
fmt.Println(cmd.StringSlice("values"))
return nil
},
Flags: []cli.Flag{
&cli.StringSliceFlag{Name: "values", Local: true},
},
}
err := app.Run(context.Background(), os.Args)
if err != nil {
log.Fatal("Error", err)
}
}
Observed behavior
$ go run . --values a,b,c --values d --values e
[e]
Expected behavior
$ go run . --values a,b,c --values d --values e
[a b c d e]
Additional context
Same problem with every slice based flags.
Want to fix this yourself?
Maybe
Run go version and paste its output here
go version go1.25.5 X:nodwarf5 linux/amd64
Run go env and paste its output here
Details
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE='on'
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/ldez/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/ldez/.config/go/env'
GOEXE=''
GOEXPERIMENT='nodwarf5'
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2592075677=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/ldez/sources/test/go.mod'
GOMODCACHE='/home/ldez/sources/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/ldez/sources/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.5 X:nodwarf5'
GOWORK=''
PKG_CONFIG='pkg-config'
My urfave/cli version is
v3.6.2
Checklist
Dependency Management
Describe the bug
The flag option
Localchanges the behavior ofStringSliceFlag.To reproduce
Observed behavior
Expected behavior
Additional context
Same problem with every slice based flags.
Want to fix this yourself?
Maybe
Run
go versionand paste its output hereRun
go envand paste its output hereDetails