cli
cli copied to clipboard
Flags no longer sort by definition order
My urfave/cli version is
v2.10.2
Checklist
- [x] Are you running the latest v2 release? The list of releases is here.
- [x] Did you check the manual for your release? The v2 manual is here
- [x] Did you perform a search about this problem? Here's the Github guide about searching.
Dependency Management
- My project is using go modules.
Describe the bug
Flags used to be shown in help text output in the same order in which they are defined in code, but they now show up as sorted by name.
To reproduce
Define more than one flag in non-lexicographical order and then view the help text output.
Observed behavior
Flags are displayed in help text output sorted lexicographically by name.
Expected behavior
Flags are displayed in the same order as they are defined in code.
Additional context
See #1411
Run go version and paste its output here
go version go1.18.3 linux/amd64
Run go env and paste its output here
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/me/.cache/go-build"
GOENV="/home/me/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/me/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/me/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/me/.gimme/versions/go1.18.3.linux.amd64"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/me/.gimme/versions/go1.18.3.linux.amd64/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/me/code/urfave/cli/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2352080075=/tmp/go-build -gno-record-gcc-switches"