Ejemplo
Setting FlagSet.ParseErrorsWhitelist.UnknownFlags = true ignores unrecognized flags during parsing, but silently consumes the immediately following non-flag token as the unknown flag's value, removing it from Args().
sha256:922657434b0768a0eafcdc138f53352c18de04eed8a691e1eba5c1a138954b04
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Evidencia de ejecución
Separamos el entorno declarado de las ejecuciones firmadas para mostrar qué se demostró.
Base de evidenciaContrato firmado aprobado
Recibos de verificación1
Nivel de verificaciónL3_CONTRACT_PASS
Entorno declarado
- Contexto de ejecución
- go
- Sistema operativo
- linux
- Arquitectura
- x64
- Runtime
- go
- Lenguaje
- go
- Gestor de paquetes
- go
Entornos de las ejecuciones de verificación
- Contexto de ejecución
- go 1.26
- Sistema operativo
- linux alpine · musl
- Arquitectura
- x64
- Runtime
- go 1.26
- Lenguaje
- go
- Gestor de paquetes
- go
- Ejecución
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17
Caso
- Objetivo
- Setting FlagSet.ParseErrorsWhitelist.UnknownFlags = true ignores unrecognized flags during parsing, but silently consumes the immediately following non-flag token as the unknown flag's value, removing it from Args(). HOW
- Paquetes
-
github.com/spf13/pflag 1.0.10
- Entorno
- go
- Creado
- 2026-08-17T12:00:26Z
Lo que suele suponerse
Enabling ParseErrorsWhitelist.UnknownFlags allows unrecognized flags to pass through without error while preserving all subsequent positional arguments in FlagSet.Args().
El autor de la muestra anotó aquí lo que un desarrollador o un modelo esperaría. El contrato de abajo es lo que realmente se ejecutó.
Contrato
- When ParseErrorsWhitelist.UnknownFlags is true, FlagSet.Parse on unknown flags without an equals sign silently consumes the following non-flag argument as the flag value, leaving Args empty rather than preserving the positional argument.
- When ParseErrorsWhitelist.UnknownFlags is true and an unknown flag is provided with an explicit inline value via equals sign, the subsequent positional argument is preserved in Args.
- When ParseErrorsWhitelist.UnknownFlags is true and an unknown flag is followed by another flag starting with a dash, the subsequent flag is not swallowed and positional arguments are preserved.
- When ParseErrorsWhitelist.UnknownFlags is false by default, FlagSet.Parse returns an unknown flag error when encountering an unrecognized flag.
Archivos
- NOTES.md
- csx.json
- go.mod
- go.sum
- pflag_config_test.go
Descargar el artefacto de código fuente (tar.gz)
Seeder de origen
csx-seed
Recibos de verificación
- go 1.26 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17 · ed25519:d91480838ac982c9