diff --git a/go.mod b/go.mod index 558dfc7e7..0c1d56595 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/AlecAivazis/survey/v2 v2.3.7 github.com/Scalingo/go-scalingo/v11 v11.1.1 github.com/Scalingo/go-utils/errors/v3 v3.2.1 - github.com/Scalingo/go-utils/logger v1.12.1 + github.com/Scalingo/go-utils/logger v1.12.2 github.com/Scalingo/go-utils/pagination v1.2.0 github.com/Scalingo/gopassword v1.1.0 github.com/briandowns/spinner v1.23.2 @@ -23,7 +23,7 @@ require ( github.com/sirupsen/logrus v1.9.4 github.com/stretchr/testify v1.11.1 github.com/stvp/rollbar v0.5.1 - github.com/urfave/cli/v3 v3.9.0 + github.com/urfave/cli/v3 v3.10.1 go.uber.org/mock v0.6.0 golang.org/x/crypto v0.53.0 golang.org/x/term v0.44.0 @@ -38,8 +38,8 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/clipperhouse/displaywidth v0.11.0 // indirect github.com/clipperhouse/uax29/v2 v2.7.0 // indirect - github.com/cloudflare/circl v1.6.3 // indirect - github.com/cyphar/filepath-securejoin v0.6.1 // indirect + github.com/cloudflare/circl v1.6.4 // indirect + github.com/cyphar/filepath-securejoin v0.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect @@ -51,10 +51,10 @@ require ( github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kevinburke/ssh_config v1.6.0 // indirect - github.com/klauspost/cpuid/v2 v2.3.0 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect + github.com/klauspost/cpuid/v2 v2.4.0 // indirect + github.com/mattn/go-colorable v0.1.15 // indirect github.com/mattn/go-isatty v0.0.22 // indirect - github.com/mattn/go-runewidth v0.0.23 // indirect + github.com/mattn/go-runewidth v0.0.24 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect github.com/olekukonko/errors v1.3.0 // indirect diff --git a/go.sum b/go.sum index a5e0f3d45..89f360ce9 100644 --- a/go.sum +++ b/go.sum @@ -13,8 +13,8 @@ github.com/Scalingo/go-scalingo/v11 v11.1.1 h1:INyoLmn8mLZYIN1JVSmI9e0P9bnYsMeAI github.com/Scalingo/go-scalingo/v11 v11.1.1/go.mod h1:lH/1yV+WQ+Vi5ByGYNJRcWQkHKLaq/vtqZaQavwi3ZA= github.com/Scalingo/go-utils/errors/v3 v3.2.1 h1:2w3qUz6MxJa3aqx/biz2G3JquSKsFnfz/E7wrNf/LPc= github.com/Scalingo/go-utils/errors/v3 v3.2.1/go.mod h1:jVVNoOdYFjuNkR/BeEZWNWJVvu4jmyLY4udlsQQyBss= -github.com/Scalingo/go-utils/logger v1.12.1 h1:r+RqwOcnsTtKoQdvcNVZCtu0Xhq01tp/3gT6+4Q7AxI= -github.com/Scalingo/go-utils/logger v1.12.1/go.mod h1:uH7LVG1pQR+5jpVgGDFyFfTMeHc3nUXC7GRUc2dPoZ4= +github.com/Scalingo/go-utils/logger v1.12.2 h1:9vm83/gqjCIy5t+OuNYjkVOUrJtdMy78XNIv8E+OCCU= +github.com/Scalingo/go-utils/logger v1.12.2/go.mod h1:vaeFcI5LMHiRRmMfJbbnblbj3RXRJIzxUcyEjZpMFpg= github.com/Scalingo/go-utils/pagination v1.2.0 h1:dTvce+thcZXH/S13HF5dxGNPCMdGALNsW6p2EYe2Pno= github.com/Scalingo/go-utils/pagination v1.2.0/go.mod h1:MwT1RRecXktFgVNeib+B4dnM4r0cPc93JichOPs5tj0= github.com/Scalingo/gopassword v1.1.0 h1:UBK4U1l3gEZ78d6ESEhkN78DmrulqYgJTazeJl6Rtog= @@ -35,12 +35,12 @@ github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSE github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0= github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= -github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8= -github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4= +github.com/cloudflare/circl v1.6.4 h1:pOXuDTCEYyzydgUpQ0CQz3LsinKjiSk6nNP5Lt5K64U= +github.com/cloudflare/circl v1.6.4/go.mod h1:YxarevkLlbaHuWsxG6vmYNWBEsSp4pnp7j+4VljMavY= github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= -github.com/cyphar/filepath-securejoin v0.6.1 h1:5CeZ1jPXEiYt3+Z6zqprSAgSWiggmpVyciv8syjIpVE= -github.com/cyphar/filepath-securejoin v0.6.1/go.mod h1:A8hd4EnAeyujCJRrICiOWqjS1AX0a9kM5XL+NwKoYSc= +github.com/cyphar/filepath-securejoin v0.7.0 h1:s0Y3ITPy6sQn5xt54DuYvTF8hu134ooYLUb58DX/HjE= +github.com/cyphar/filepath-securejoin v0.7.0/go.mod h1:ymLGms/u3BYaviIiuKFnUx8EkQEZeK6cInNoAPJA3o4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -92,8 +92,8 @@ github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dv github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kevinburke/ssh_config v1.6.0 h1:J1FBfmuVosPHf5GRdltRLhPJtJpTlMdKTBjRgTaQBFY= github.com/kevinburke/ssh_config v1.6.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M= -github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= -github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw= +github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -102,13 +102,13 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY= +github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4= github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4= -github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw= -github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= +github.com/mattn/go-runewidth v0.0.24 h1:cpokDiIn0MGnhdHwuWnJBITySJ20QyNGnY2kR/ay2DU= +github.com/mattn/go-runewidth v0.0.24/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= @@ -147,8 +147,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/stvp/rollbar v0.5.1 h1:qvyWbd0RNL5V27MBumqCXlcU7ohmHeEtKX+Czc8oeuw= github.com/stvp/rollbar v0.5.1/go.mod h1:/fyFC854GgkbHRz/rSsiYc6h84o0G5hxBezoQqRK7Ho= -github.com/urfave/cli/v3 v3.9.0 h1:AV9lIiPv3ukYnxunaCUsHnEozptYmDN2F0+yWqLMn/c= -github.com/urfave/cli/v3 v3.9.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= +github.com/urfave/cli/v3 v3.10.1 h1:7Kx9H50hrHbRbyxgO1KP6/BcbiGRz0uYh5YyQ30JEEY= +github.com/urfave/cli/v3 v3.10.1/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= diff --git a/vendor/github.com/Scalingo/go-utils/logger/CHANGELOG.md b/vendor/github.com/Scalingo/go-utils/logger/CHANGELOG.md index f11ffedf7..20581f033 100644 --- a/vendor/github.com/Scalingo/go-utils/logger/CHANGELOG.md +++ b/vendor/github.com/Scalingo/go-utils/logger/CHANGELOG.md @@ -2,6 +2,10 @@ ## To be Released +## v1.12.2 + +* refactor: replace `github.com/pkg/errors` with `errors` + ## v1.12.1 * chore(deps): bump github.com/Scalingo/logrus-rollbar from 1.4.3 to 1.4.4 diff --git a/vendor/github.com/Scalingo/go-utils/logger/README.md b/vendor/github.com/Scalingo/go-utils/logger/README.md index 3cb2226bc..e95726a68 100644 --- a/vendor/github.com/Scalingo/go-utils/logger/README.md +++ b/vendor/github.com/Scalingo/go-utils/logger/README.md @@ -1,4 +1,4 @@ -# Package `logger` v1.12.1 +# Package `logger` v1.12.2 This package will provide you a generic way to handle logging. diff --git a/vendor/github.com/Scalingo/go-utils/logger/redacting_formatter.go b/vendor/github.com/Scalingo/go-utils/logger/redacting_formatter.go index 44c351335..0d5072a47 100644 --- a/vendor/github.com/Scalingo/go-utils/logger/redacting_formatter.go +++ b/vendor/github.com/Scalingo/go-utils/logger/redacting_formatter.go @@ -1,9 +1,9 @@ package logger import ( + "errors" "regexp" - "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/vendor/github.com/cyphar/filepath-securejoin/CHANGELOG.md b/vendor/github.com/cyphar/filepath-securejoin/CHANGELOG.md index 6d016d05c..f8fbb6b62 100644 --- a/vendor/github.com/cyphar/filepath-securejoin/CHANGELOG.md +++ b/vendor/github.com/cyphar/filepath-securejoin/CHANGELOG.md @@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] ## +## [0.7.0] - 2025-06-17 ## + +> You talk of times of peace for all, and then prepare for war. + +### Changed ### +- Update to `cyphar.com/go-pathrs@0.2.5`, which included a build-time API + breakage that we needed to work around. The API of this library is unchanged + by this, but users should make sure to update to `v0.7.0` of + `filepath-securejoin` if they use the `libpathrs` built tag and have update + to `libpathrs` `v0.2.5`. + ## [0.6.1] - 2025-11-19 ## > At last up jumped the cunning spider, and fiercely held her fast. diff --git a/vendor/github.com/cyphar/filepath-securejoin/VERSION b/vendor/github.com/cyphar/filepath-securejoin/VERSION index ee6cdce3c..faef31a43 100644 --- a/vendor/github.com/cyphar/filepath-securejoin/VERSION +++ b/vendor/github.com/cyphar/filepath-securejoin/VERSION @@ -1 +1 @@ -0.6.1 +0.7.0 diff --git a/vendor/github.com/klauspost/cpuid/v2/.goreleaser.yml b/vendor/github.com/klauspost/cpuid/v2/.goreleaser.yml index 1b695b62c..14712fe0d 100644 --- a/vendor/github.com/klauspost/cpuid/v2/.goreleaser.yml +++ b/vendor/github.com/klauspost/cpuid/v2/.goreleaser.yml @@ -29,7 +29,7 @@ archives: name_template: "cpuid-{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" format_overrides: - goos: windows - format: zip + formats: [ 'zip' ] files: - LICENSE checksum: diff --git a/vendor/github.com/klauspost/cpuid/v2/README.md b/vendor/github.com/klauspost/cpuid/v2/README.md index 88d68d528..a99bbdba3 100644 --- a/vendor/github.com/klauspost/cpuid/v2/README.md +++ b/vendor/github.com/klauspost/cpuid/v2/README.md @@ -2,7 +2,7 @@ Package cpuid provides information about the CPU running the current program. CPU features are detected on startup, and kept for fast access through the life of the application. -Currently x86 / x64 (AMD64/i386) and ARM (ARM64) is supported, and no external C (cgo) code is used, which should make the library very easy to use. +Currently x86 / x64 (AMD64/i386), ARM (ARM64), and RISC-V (RV64) are supported, and no external C (cgo) code is used, which should make the library very easy to use. You can access the CPU information by accessing the shared CPU variable of the cpuid library. @@ -506,6 +506,74 @@ Exit Code 1 | SM3 | SM3 instructions | | SM4 | SM4 instructions | | SVE | Scalable Vector Extension | +| SVE2 | Scalable Vector Extension 2 | +| SB | Speculation barrier (SB instruction) | +| SSBS | Speculative Store Bypass Safe (PSTATE.SSBS) | +| BTI | Branch Target Identification | +| FLAGM2 | Condition flag manipulation version 2 (AXFLAG, XAFLAG) | +| FRINTTS | Floating-point to integer rounding (FRINT32Z, FRINT64Z, etc) | +| DCPODP | Data cache clean to Point of Deep Persistence (DC CVADP) | +| BF16 | BFloat16 instructions (BFDOT, BFMMLA, etc) | +| I8MM | Int8 matrix multiplication (SMMLA, UMMLA, USMMLA) | +| WFXT | WFE/WFI with timeout (WFET, WFIT) | +| MOPS | Memory copy and set instructions (CPYF, SETP, etc) | +| HBC | Hinted conditional branches (BC.cond) | +| CSSC | Common short sequence compression (ABS, SMAX, UMAX, etc) | + +## riscv64 feature detection + +On `riscv64/linux`, CPU features are detected using the `riscv_hwprobe` syscall (Linux 6.4+). +For older kernels, detection falls back to parsing `/proc/cpuinfo` for the ISA string. + +Cache line size is detected via `riscv_hwprobe` (Zicbom block size) or sysfs fallback. +Other cache and topology information is not yet available. + +# RISC-V features: + +| Feature Flag | Description | +|----------------|----------------------------------------------------| +| RV_IMA | IMA base (Integer, Multiply, Atomic) | +| RV_C | Compressed instructions | +| RV_F | Single-precision FP | +| RV_D | Double-precision FP | +| RV_V | Vector extension (V) | +| RV_ZBA | Address generation | +| RV_ZBB | Basic bit manipulation | +| RV_ZBC | Carry-less multiplication | +| RV_ZBS | Single-bit manipulation | +| RV_ZICOND | Integer conditional operations | +| RV_ZIHINTPAUSE | Pause hint | +| RV_ZICBOM | Cache block management operations | +| RV_ZICBOZ | Cache block zero | +| RV_ZICBOP | Cache block prefetch | +| RV_ZFA | Additional floating-point | +| RV_ZFH | Half-precision FP | +| RV_ZFHMIN | Minimal half-precision FP | +| RV_ZTSO | Total store ordering | +| RV_ZACAS | Atomic CAS | +| RV_ZBKB | Bit-manipulation for crypto | +| RV_ZBKC | Carry-less multiply for crypto | +| RV_ZBKX | Crossbar permutations | +| RV_ZKND | NIST Suite: AES decrypt | +| RV_ZKNE | NIST Suite: AES encrypt | +| RV_ZKNH | NIST Suite: SHA-2 (SHA-256/SHA-512) | +| RV_ZKSED | ShangMi Suite: SM4 block cipher | +| RV_ZKSH | ShangMi Suite: SM3 hash | +| RV_ZKT | Data-independent execution latency (Crypto) | +| RV_ZKN | NIST Algorithm Suite (combined from individual) | +| RV_ZKS | ShangMi Algorithm Suite (combined from individual) | +| RV_ZVBB | Vector Basic Bit-manipulation | +| RV_ZVBC | Vector Carry-less multiply | +| RV_ZVKB | Vector Bit-manipulation for crypto | +| RV_ZVKG | Vector GCM/GMAC | +| RV_ZVKNED | NIST Suite: Vector AES encrypt+decrypt | +| RV_ZVKNHA | NIST Suite: Vector SHA-2 (SHA-256) | +| RV_ZVKNHB | NIST Suite: Vector SHA-2 (SHA-512) | +| RV_ZVKSED | ShangMi Suite: Vector SM4 | +| RV_ZVKSH | ShangMi Suite: Vector SM3 hash | +| RV_ZVKT | Vector Data-independent execution latency | +| RV_ZVKNG | NIST Suite with GCM (combined from individual) | +| RV_ZVKSG | ShangMi Suite with GCM (combined from individual) | # license diff --git a/vendor/github.com/klauspost/cpuid/v2/cpuid.go b/vendor/github.com/klauspost/cpuid/v2/cpuid.go index 9cf7738a9..db903f46a 100644 --- a/vendor/github.com/klauspost/cpuid/v2/cpuid.go +++ b/vendor/github.com/klauspost/cpuid/v2/cpuid.go @@ -3,7 +3,7 @@ // Package cpuid provides information about the CPU running the current program. // // CPU features are detected on startup, and kept for fast access through the life of the application. -// Currently x86 / x64 (AMD64) as well as arm64 is supported. +// Currently x86 / x64 (AMD64), arm64, and riscv64 are supported. // // You can access the CPU information by accessing the shared CPU variable of the cpuid library. // @@ -17,6 +17,7 @@ import ( "math/bits" "os" "runtime" + "slices" "strings" ) @@ -61,6 +62,13 @@ const ( SRE Apple + // RISC-V vendors + SiFive + StarFive + THead + Andes + SpacemiT + lastVendor ) @@ -95,6 +103,7 @@ const ( AVX2 // AVX2 functions AVX512BF16 // AVX-512 BFLOAT16 Instructions AVX512BITALG // AVX-512 Bit Algorithms + AVX512BMM // AVX-512 Bit Manipulation Instructions AVX512BW // AVX-512 Byte and Word Instructions AVX512CD // AVX-512 Conflict Detection Instructions AVX512DQ // AVX-512 Doubleword and Quadword Instructions @@ -139,6 +148,7 @@ const ( FMA4 // Bulldozer FMA4 functions FP128 // AMD: When set, the internal FP/SIMD execution datapath is no more than 128-bits wide FP256 // AMD: When set, the internal FP/SIMD execution datapath is no more than 256-bits wide + FRED // Flexible Return and Event Delivery FSRM // Fast Short Rep Mov FXSR // FXSAVE, FXRESTOR instructions, CR4 bit 9 FXSROPT // FXSAVE/FXRSTOR optimizations @@ -308,6 +318,19 @@ const ( SM3 // SM3 instructions SM4 // SM4 instructions SVE // Scalable Vector Extension + SVE2 // Scalable Vector Extension 2 + SB // Speculation barrier (SB instruction) + SSBS // Speculative Store Bypass Safe (PSTATE.SSBS) + BTI // Branch Target Identification + FLAGM2 // Condition flag manipulation version 2 (AXFLAG, XAFLAG) + FRINTTS // Floating-point to integer rounding (FRINT32Z, FRINT64Z, etc) + DCPODP // Data cache clean to Point of Deep Persistence (DC CVADP) + BF16 // BFloat16 instructions (BFDOT, BFMMLA, etc) + I8MM // Int8 matrix multiplication (SMMLA, UMMLA, USMMLA) + WFXT // WFE/WFI with timeout (WFET, WFIT) + MOPS // Memory copy and set instructions (CPYF, SETP, etc) + HBC // Hinted conditional branches (BC.cond) + CSSC // Common short sequence compression (ABS, SMAX, UMAX, etc) // PMU PMU_FIXEDCOUNTER_CYCLES @@ -315,6 +338,57 @@ const ( PMU_FIXEDCOUNTER_INSTRUCTIONS PMU_FIXEDCOUNTER_TOPDOWN_SLOTS + // RISC-V features + RV_IMA // IMA base (Integer, Multiply, Atomic) + RV_C // Compressed instructions + RV_F // Single-precision FP + RV_D // Double-precision FP + RV_V // Vector extension (V) + RV_ZBA // Address generation + RV_ZBB // Basic bit manipulation + RV_ZBC // Carry-less multiplication + RV_ZBS // Single-bit manipulation + RV_ZICOND // Integer conditional operations + RV_ZIHINTPAUSE // Pause hint + RV_ZICBOM // Cache block management operations + RV_ZICBOZ // Cache block zero + RV_ZICBOP // Cache block prefetch + RV_ZFA // Additional floating-point + RV_ZFH // Half-precision FP + RV_ZFHMIN // Minimal half-precision FP + RV_ZTSO // Total store ordering + RV_ZACAS // Atomic CAS + // Scalar cryptography + RV_ZBKB // Bit-manipulation for crypto + RV_ZBKC // Carry-less multiply for crypto + RV_ZBKX // Crossbar permutations + RV_ZKND // NIST Suite: AES decrypt + RV_ZKNE // NIST Suite: AES encrypt + RV_ZKNH // NIST Suite: SHA-2 (SHA-256/SHA-512) + RV_ZKSED // ShangMi Suite: SM4 block cipher + RV_ZKSH // ShangMi Suite: SM3 hash + RV_ZKT // Data-independent execution latency (Crypto) + + // Scalar crypto suites (combined from individual extensions) + RV_ZKN // NIST Algorithm Suite (Zknd+Zkne+Zknh+Zbkb+Zbkc+Zbkx+Zkt) + RV_ZKS // ShangMi Algorithm Suite (Zksed+Zksh+Zbkb+Zbkc+Zbkx+Zkt) + + // Vector cryptography + RV_ZVBB // Vector Basic Bit-manipulation + RV_ZVBC // Vector Carry-less multiply + RV_ZVKB // Vector Bit-manipulation for crypto + RV_ZVKG // Vector GCM/GMAC + RV_ZVKNED // NIST Suite: Vector AES encrypt+decrypt + RV_ZVKNHA // NIST Suite: Vector SHA-2 (SHA-256) + RV_ZVKNHB // NIST Suite: Vector SHA-2 (SHA-512) + RV_ZVKSED // ShangMi Suite: Vector SM4 + RV_ZVKSH // ShangMi Suite: Vector SM3 hash + RV_ZVKT // Vector Data-independent execution latency + + // Vector crypto suites (combined from individual extensions) + RV_ZVKNG // NIST Suite with GCM (Zvkned+Zvknhb+Zvkg+Zvkb+Zvkt) + RV_ZVKSG // ShangMi Suite with GCM (Zvksed+Zvksh+Zvkg+Zvkb+Zvkt) + // Keep it last. It automatically defines the size of []flagSet lastID @@ -419,8 +493,8 @@ func Detect() { os.Exit(1) } if disableFlag != nil { - s := strings.Split(*disableFlag, ",") - for _, feat := range s { + s := strings.SplitSeq(*disableFlag, ",") + for feat := range s { feat := ParseFeature(strings.TrimSpace(feat)) if feat != UNKNOWN { CPU.featureSet.unset(feat) @@ -471,12 +545,7 @@ func (c *CPUInfo) Has(id FeatureID) bool { // AnyOf returns whether the CPU supports one or more of the requested features. func (c CPUInfo) AnyOf(ids ...FeatureID) bool { - for _, id := range ids { - if c.featureSet.inSet(id) { - return true - } - } - return false + return slices.ContainsFunc(ids, c.featureSet.inSet) } // Features contains several features combined for a fast check using @@ -496,6 +565,11 @@ func (c *CPUInfo) HasAll(f Features) bool { return c.featureSet.hasSetP(f) } +// HasOneOf returns whether the CPU supports one or more of the requested features. +func (c *CPUInfo) HasOneOf(f Features) bool { + return c.featureSet.hasOneOf(f) +} + // https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels var oneOfLevel = CombineFeatures(SYSEE, SYSCALL) var level1Features = CombineFeatures(CMOV, CMPXCHG8, X87, FXSR, MMX, SSE, SSE2) @@ -503,6 +577,56 @@ var level2Features = CombineFeatures(CMOV, CMPXCHG8, X87, FXSR, MMX, SSE, SSE2, var level3Features = CombineFeatures(CMOV, CMPXCHG8, X87, FXSR, MMX, SSE, SSE2, CX16, LAHF, POPCNT, SSE3, SSE4, SSE42, SSSE3, AVX, AVX2, BMI1, BMI2, F16C, FMA3, LZCNT, MOVBE, OSXSAVE) var level4Features = CombineFeatures(CMOV, CMPXCHG8, X87, FXSR, MMX, SSE, SSE2, CX16, LAHF, POPCNT, SSE3, SSE4, SSE42, SSSE3, AVX, AVX2, BMI1, BMI2, F16C, FMA3, LZCNT, MOVBE, OSXSAVE, AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL) +// RV_CRYPTO_FEATS contains all RISC-V scalar cryptography instruction extensions (excludes Zkt since it is a timing guarantee, not a computational instruction). +var RV_CRYPTO_FEATS = CombineFeatures(RV_ZBKB, RV_ZBKC, RV_ZBKX, RV_ZKND, RV_ZKNE, RV_ZKNH, RV_ZKSED, RV_ZKSH) + +// RV_VECTOR_CRYPTO_FEATS contains all RISC-V vector cryptography extensions. +var RV_VECTOR_CRYPTO_FEATS = CombineFeatures(RV_ZVBB, RV_ZVBC, RV_ZVKB, RV_ZVKG, RV_ZVKNED, RV_ZVKNHA, RV_ZVKNHB, RV_ZVKSED, RV_ZVKSH) + +// RISC-V application profile feature sets. +// https://github.com/riscv/riscv-profiles +var rvProfile20Features = CombineFeatures(RV_IMA, RV_C, RV_F, RV_D) +var rvProfile22Features = CombineFeatures(RV_IMA, RV_C, RV_F, RV_D, RV_ZBA, RV_ZBB, RV_ZBS, RV_ZFHMIN, RV_ZICBOM, RV_ZICBOP, RV_ZICBOZ, RV_ZIHINTPAUSE) +var rvProfile23Features = CombineFeatures(RV_IMA, RV_C, RV_F, RV_D, RV_ZBA, RV_ZBB, RV_ZBS, RV_ZFHMIN, RV_ZICBOM, RV_ZICBOP, RV_ZICBOZ, RV_ZIHINTPAUSE, RV_V, RV_ZFA, RV_ZICOND, RV_ZVBB, RV_ZVKB) + +// RISC-V crypto suites — combined from individual extensions. +var rvZKNFeatures = CombineFeatures(RV_ZKND, RV_ZKNE, RV_ZKNH, RV_ZBKB, RV_ZBKC, RV_ZBKX, RV_ZKT) +var rvZKSFeatures = CombineFeatures(RV_ZKSED, RV_ZKSH, RV_ZBKB, RV_ZBKC, RV_ZBKX, RV_ZKT) +var rvZVKNFeatures = CombineFeatures(RV_ZVKNED, RV_ZVKNHB, RV_ZVKG, RV_ZVKB, RV_ZVKT) +var rvZVKSFeatures = CombineFeatures(RV_ZVKSED, RV_ZVKSH, RV_ZVKG, RV_ZVKB, RV_ZVKT) + +// ARM64 architecture levels. armV8Levels[m] is the cumulative set of mandatory +// user-space instruction features added up to and including ARMv8.m that this +// package can detect. EL1/system-only features (PAN, VHE, CSV2/CSV3, ECV, ...) +// are excluded since they are irrelevant to user-space code generation, exactly +// as X64Level ignores non-instruction features. +// +// FEAT_SSBS and FEAT_BTI, although mandatory from ARMv8.5, are intentionally NOT +// required. Both are OS-policy-gated security features (speculative store bypass +// safety and branch-target identification) that Go code generation never depends +// on: their HWCAP/sysctl bits are set only when the OS or hypervisor enables the +// protection, not purely from CPU capability, so they are routinely hidden even +// on capable silicon (neither a Neoverse N2 Linux guest nor Apple Silicon reports +// them). Requiring them would cap such CPUs at v8.4. Both are still detected and +// reported through FeatureSet when present. +// https://go.dev/wiki/MinimumRequirements#arm64 +var armV8Levels = [...]Features{ + CombineFeatures(FP, ASIMD), // v8.0 + CombineFeatures(FP, ASIMD, ATOMICS, CRC32, ASIMDRDM), // v8.1 + CombineFeatures(FP, ASIMD, ATOMICS, CRC32, ASIMDRDM, DCPOP), // v8.2 + CombineFeatures(FP, ASIMD, ATOMICS, CRC32, ASIMDRDM, DCPOP, JSCVT, FCMA, LRCPC), // v8.3 + CombineFeatures(FP, ASIMD, ATOMICS, CRC32, ASIMDRDM, DCPOP, JSCVT, FCMA, LRCPC, TS), // v8.4 + CombineFeatures(FP, ASIMD, ATOMICS, CRC32, ASIMDRDM, DCPOP, JSCVT, FCMA, LRCPC, TS, SB, FRINTTS, FLAGM2, DCPODP), // v8.5 + CombineFeatures(FP, ASIMD, ATOMICS, CRC32, ASIMDRDM, DCPOP, JSCVT, FCMA, LRCPC, TS, SB, FRINTTS, FLAGM2, DCPODP, BF16, I8MM), // v8.6 + CombineFeatures(FP, ASIMD, ATOMICS, CRC32, ASIMDRDM, DCPOP, JSCVT, FCMA, LRCPC, TS, SB, FRINTTS, FLAGM2, DCPODP, BF16, I8MM, WFXT), // v8.7 + CombineFeatures(FP, ASIMD, ATOMICS, CRC32, ASIMDRDM, DCPOP, JSCVT, FCMA, LRCPC, TS, SB, FRINTTS, FLAGM2, DCPODP, BF16, I8MM, WFXT, MOPS, HBC), // v8.8 + CombineFeatures(FP, ASIMD, ATOMICS, CRC32, ASIMDRDM, DCPOP, JSCVT, FCMA, LRCPC, TS, SB, FRINTTS, FLAGM2, DCPODP, BF16, I8MM, WFXT, MOPS, HBC, CSSC), // v8.9 +} + +// armCrypto matches the GOARM64 ",crypto" option: FEAT_AES, FEAT_PMULL, +// FEAT_SHA1 and FEAT_SHA256. +var armCrypto = CombineFeatures(AESARM, PMULL, SHA1, SHA2) + // X64Level returns the microarchitecture level detected on the CPU. // If features are lacking or non x64 mode, 0 is returned. // See https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels @@ -525,6 +649,67 @@ func (c CPUInfo) X64Level() int { return 0 } +// RVProfile returns the RISC-V application profile level. +// 0 = unknown / base ISA only, 20 = RVA20, 22 = RVA22, 23 = RVA23. +// Returns 0 on non-RISC-V architectures or if not detected. +// https://github.com/riscv/riscv-profiles +func (c CPUInfo) RVProfile() int { + switch { + case c.featureSet.hasSetP(rvProfile23Features): + return 23 + case c.featureSet.hasSetP(rvProfile22Features): + return 22 + case c.featureSet.hasSetP(rvProfile20Features): + return 20 + default: + return 0 + } +} + +// ARM64Level returns the ARMv8/ARMv9 architecture version supported by the CPU +// as (major, minor), e.g. 8, 4 for ARMv8.4-A or 9, 0 for ARMv9.0-A. +// Only mandatory user-space instruction features are considered, so the result +// is the highest level whose required instructions are all present. +// Returns 0, 0 on non-arm64 CPUs or when feature detection was unavailable. +func (c CPUInfo) ARM64Level() (major, minor int) { + if !c.featureSet.hasSetP(armV8Levels[0]) { + return 0, 0 + } + m8 := 0 + for m := len(armV8Levels) - 1; m >= 1; m-- { + if c.featureSet.hasSetP(armV8Levels[m]) { + m8 = m + break + } + } + // ARMv9.x mandates everything in ARMv8.(x+5) plus SVE2. + if m8 >= 5 && c.featureSet.inSet(SVE2) { + return 9, m8 - 5 + } + return 8, m8 +} + +// GOARM64 returns a value usable as the GOARM64 build setting for the detected +// CPU, e.g. "v8.4" or "v9.0,crypto". The ",crypto" suffix is appended when AES, +// PMULL, SHA1 and SHA256 are all present; the ",lse" suffix is appended in the +// rare case LSE is present without the rest of the ARMv8.1 feature set. +// Returns "" on non-arm64 CPUs or when feature detection was unavailable. +// See https://go.dev/wiki/MinimumRequirements#arm64 +func (c CPUInfo) GOARM64() string { + major, minor := c.ARM64Level() + if major == 0 { + return "" + } + v := fmt.Sprintf("v%d.%d", major, minor) + if major == 8 && minor == 0 && c.featureSet.inSet(ATOMICS) { + v += ",lse" + } + if c.featureSet.hasSetP(armCrypto) { + v += ",crypto" + } + return v +} + // Disable will disable one or several features. func (c *CPUInfo) Disable(ids ...FeatureID) bool { for _, id := range ids { @@ -771,7 +956,7 @@ func flagSetWith(feat ...FeatureID) flagSet { // Will return UNKNOWN if not found. func ParseFeature(s string) FeatureID { s = strings.ToUpper(s) - for i := firstID; i < lastID; i++ { + for i := range lastID { if i.String() == s { return i } @@ -785,7 +970,7 @@ func (s flagSet) Strings() []string { return []string{""} } r := make([]string, 0) - for i := firstID; i < lastID; i++ { + for i := range lastID { if s.inSet(i) { r = append(r, i.String()) } @@ -806,7 +991,7 @@ func maxFunctionID() uint32 { func brandName() string { if maxExtendedFunction() >= 0x80000004 { v := make([]uint32, 0, 48) - for i := uint32(0); i < 3; i++ { + for i := range uint32(3) { a, b, c, d := cpuid(0x80000002 + i) v = append(v, a, b, c, d) } @@ -1075,7 +1260,7 @@ func (c *CPUInfo) cacheSize() { // Hack: When we encounter the same entry 100 times we break. nSame := 0 var last uint32 - for i := uint32(0); i < math.MaxUint32; i++ { + for i := range uint32(math.MaxUint32) { eax, ebx, ecx, _ := cpuidex(0x8000001D, i) level := (eax >> 5) & 7 @@ -1329,6 +1514,7 @@ func support() flagSet { fs.setIf(eax1&(1<<10) != 0, MOVSB_ZL) fs.setIf(eax1&(1<<11) != 0, STOSB_SHORT) fs.setIf(eax1&(1<<12) != 0, CMPSB_SCADBS_SHORT) + fs.setIf(eax1&(1<<17) != 0, FRED) fs.setIf(eax1&(1<<22) != 0, HRESET) fs.setIf(eax1&(1<<23) != 0, AVXIFMA) fs.setIf(eax1&(1<<26) != 0, LAM) @@ -1562,6 +1748,7 @@ func support() flagSet { fs.setIf((a>>29)&1 == 1, SRSO_NO) fs.setIf((a>>28)&1 == 1, IBPB_BRTYPE) fs.setIf((a>>27)&1 == 1, SBPB) + fs.setIf((a>>23)&1 == 1, AVX512BMM) fs.setIf((c>>1)&1 == 1, TSA_L1_NO) fs.setIf((c>>2)&1 == 1, TSA_SQ_NO) fs.setIf((a>>5)&1 == 1, TSA_VERW_CLEAR) diff --git a/vendor/github.com/klauspost/cpuid/v2/detect_arm64.go b/vendor/github.com/klauspost/cpuid/v2/detect_arm64.go index 9ae32d607..e615b10be 100644 --- a/vendor/github.com/klauspost/cpuid/v2/detect_arm64.go +++ b/vendor/github.com/klauspost/cpuid/v2/detect_arm64.go @@ -1,7 +1,6 @@ // Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. //go:build arm64 && !gccgo && !noasm && !appengine -// +build arm64,!gccgo,!noasm,!appengine package cpuid @@ -189,6 +188,7 @@ func addInfo(c *CPUInfo, safe bool) { f.setIf(instAttrReg0&(0xf<<60) != 0, RNDR) f.setIf(instAttrReg0&(0xf<<56) != 0, TLB) f.setIf(instAttrReg0&(0xf<<52) != 0, TS) + f.setIf(instAttrReg0&(0xf<<52) == 2<<52, FLAGM2) // TS == 0b0010 (FEAT_FlagM2) f.setIf(instAttrReg0&(0xf<<48) != 0, FHM) f.setIf(instAttrReg0&(0xf<<44) != 0, ASIMDDP) f.setIf(instAttrReg0&(0xf<<40) != 0, SM4) @@ -244,6 +244,13 @@ func addInfo(c *CPUInfo, safe bool) { // fmt.Println("APA") // } f.setIf(instAttrReg1&(0xf<<0) != 0, DCPOP) + f.setIf(instAttrReg1&(0xf<<0) == 2<<0, DCPODP) // DPB == 0b0010 (FEAT_DPB2) + + // Upper ID_AA64ISAR1_EL1 fields, not in the table above. + f.setIf(instAttrReg1&(0xf<<32) != 0, FRINTTS) // bits [35:32] + f.setIf(instAttrReg1&(0xf<<36) != 0, SB) // bits [39:36] + f.setIf(instAttrReg1&(0xf<<44) != 0, BF16) // bits [47:44] + f.setIf(instAttrReg1&(0xf<<52) != 0, I8MM) // bits [55:52] // Store c.featureSet.or(f) diff --git a/vendor/github.com/klauspost/cpuid/v2/detect_ref.go b/vendor/github.com/klauspost/cpuid/v2/detect_ref.go index 574f9389c..38699f4d7 100644 --- a/vendor/github.com/klauspost/cpuid/v2/detect_ref.go +++ b/vendor/github.com/klauspost/cpuid/v2/detect_ref.go @@ -1,7 +1,6 @@ // Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. -//go:build (!amd64 && !386 && !arm64) || gccgo || noasm || appengine -// +build !amd64,!386,!arm64 gccgo noasm appengine +//go:build (!amd64 && !386 && !arm64 && !riscv64) || ((amd64 || 386) && (gccgo || noasm || appengine)) package cpuid diff --git a/vendor/github.com/klauspost/cpuid/v2/detect_ref_arm64.go b/vendor/github.com/klauspost/cpuid/v2/detect_ref_arm64.go new file mode 100644 index 000000000..d2ea76ba8 --- /dev/null +++ b/vendor/github.com/klauspost/cpuid/v2/detect_ref_arm64.go @@ -0,0 +1,19 @@ +// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. + +//go:build arm64 && (gccgo || noasm || appengine) + +package cpuid + +func initCPU() { + cpuid = func(uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 } + cpuidex = func(x, y uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 } + xgetbv = func(uint32) (a, b uint32) { return 0, 0 } + rdtscpAsm = func() (a, b, c, d uint32) { return 0, 0, 0, 0 } +} + +func addInfo(c *CPUInfo, safe bool) { + c.CacheLine = 64 + detectOS(c) +} + +func getVectorLength() (vl, pl uint64) { return 0, 0 } diff --git a/vendor/github.com/klauspost/cpuid/v2/detect_riscv64.go b/vendor/github.com/klauspost/cpuid/v2/detect_riscv64.go new file mode 100644 index 000000000..25381f089 --- /dev/null +++ b/vendor/github.com/klauspost/cpuid/v2/detect_riscv64.go @@ -0,0 +1,16 @@ +// Copyright (c) 2026 Klaus Post, released under MIT License. See LICENSE file. + +package cpuid + +func getVectorLength() (vl, pl uint64) { return 0, 0 } + +func initCPU() { + cpuid = func(uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 } + cpuidex = func(x, y uint32) (a, b, c, d uint32) { return 0, 0, 0, 0 } + xgetbv = func(uint32) (a, b uint32) { return 0, 0 } + rdtscpAsm = func() (a, b, c, d uint32) { return 0, 0, 0, 0 } +} + +func addInfo(c *CPUInfo, safe bool) { + detectOS(c) +} diff --git a/vendor/github.com/klauspost/cpuid/v2/detect_x86.go b/vendor/github.com/klauspost/cpuid/v2/detect_x86.go index 14a56b930..22819ce4a 100644 --- a/vendor/github.com/klauspost/cpuid/v2/detect_x86.go +++ b/vendor/github.com/klauspost/cpuid/v2/detect_x86.go @@ -1,7 +1,6 @@ // Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file. //go:build (386 && !gccgo && !noasm && !appengine) || (amd64 && !gccgo && !noasm && !appengine) -// +build 386,!gccgo,!noasm,!appengine amd64,!gccgo,!noasm,!appengine package cpuid diff --git a/vendor/github.com/klauspost/cpuid/v2/featureid_string.go b/vendor/github.com/klauspost/cpuid/v2/featureid_string.go index 2888bae8f..f88ead130 100644 --- a/vendor/github.com/klauspost/cpuid/v2/featureid_string.go +++ b/vendor/github.com/klauspost/cpuid/v2/featureid_string.go @@ -29,234 +29,292 @@ func _() { _ = x[AVX2-19] _ = x[AVX512BF16-20] _ = x[AVX512BITALG-21] - _ = x[AVX512BW-22] - _ = x[AVX512CD-23] - _ = x[AVX512DQ-24] - _ = x[AVX512ER-25] - _ = x[AVX512F-26] - _ = x[AVX512FP16-27] - _ = x[AVX512IFMA-28] - _ = x[AVX512PF-29] - _ = x[AVX512VBMI-30] - _ = x[AVX512VBMI2-31] - _ = x[AVX512VL-32] - _ = x[AVX512VNNI-33] - _ = x[AVX512VP2INTERSECT-34] - _ = x[AVX512VPOPCNTDQ-35] - _ = x[AVXIFMA-36] - _ = x[AVXNECONVERT-37] - _ = x[AVXSLOW-38] - _ = x[AVXVNNI-39] - _ = x[AVXVNNIINT8-40] - _ = x[AVXVNNIINT16-41] - _ = x[BHI_CTRL-42] - _ = x[BMI1-43] - _ = x[BMI2-44] - _ = x[CETIBT-45] - _ = x[CETSS-46] - _ = x[CLDEMOTE-47] - _ = x[CLMUL-48] - _ = x[CLZERO-49] - _ = x[CMOV-50] - _ = x[CMPCCXADD-51] - _ = x[CMPSB_SCADBS_SHORT-52] - _ = x[CMPXCHG8-53] - _ = x[CPBOOST-54] - _ = x[CPPC-55] - _ = x[CX16-56] - _ = x[EFER_LMSLE_UNS-57] - _ = x[ENQCMD-58] - _ = x[ERMS-59] - _ = x[F16C-60] - _ = x[FLUSH_L1D-61] - _ = x[FMA3-62] - _ = x[FMA4-63] - _ = x[FP128-64] - _ = x[FP256-65] - _ = x[FSRM-66] - _ = x[FXSR-67] - _ = x[FXSROPT-68] - _ = x[GFNI-69] - _ = x[HLE-70] - _ = x[HRESET-71] - _ = x[HTT-72] - _ = x[HWA-73] - _ = x[HYBRID_CPU-74] - _ = x[HYPERVISOR-75] - _ = x[IA32_ARCH_CAP-76] - _ = x[IA32_CORE_CAP-77] - _ = x[IBPB-78] - _ = x[IBPB_BRTYPE-79] - _ = x[IBRS-80] - _ = x[IBRS_PREFERRED-81] - _ = x[IBRS_PROVIDES_SMP-82] - _ = x[IBS-83] - _ = x[IBSBRNTRGT-84] - _ = x[IBSFETCHSAM-85] - _ = x[IBSFFV-86] - _ = x[IBSOPCNT-87] - _ = x[IBSOPCNTEXT-88] - _ = x[IBSOPSAM-89] - _ = x[IBSRDWROPCNT-90] - _ = x[IBSRIPINVALIDCHK-91] - _ = x[IBS_FETCH_CTLX-92] - _ = x[IBS_OPDATA4-93] - _ = x[IBS_OPFUSE-94] - _ = x[IBS_PREVENTHOST-95] - _ = x[IBS_ZEN4-96] - _ = x[IDPRED_CTRL-97] - _ = x[INT_WBINVD-98] - _ = x[INVLPGB-99] - _ = x[KEYLOCKER-100] - _ = x[KEYLOCKERW-101] - _ = x[LAHF-102] - _ = x[LAM-103] - _ = x[LBRVIRT-104] - _ = x[LZCNT-105] - _ = x[MCAOVERFLOW-106] - _ = x[MCDT_NO-107] - _ = x[MCOMMIT-108] - _ = x[MD_CLEAR-109] - _ = x[MMX-110] - _ = x[MMXEXT-111] - _ = x[MOVBE-112] - _ = x[MOVDIR64B-113] - _ = x[MOVDIRI-114] - _ = x[MOVSB_ZL-115] - _ = x[MOVU-116] - _ = x[MPX-117] - _ = x[MSRIRC-118] - _ = x[MSRLIST-119] - _ = x[MSR_PAGEFLUSH-120] - _ = x[NRIPS-121] - _ = x[NX-122] - _ = x[OSXSAVE-123] - _ = x[PCONFIG-124] - _ = x[POPCNT-125] - _ = x[PPIN-126] - _ = x[PREFETCHI-127] - _ = x[PSFD-128] - _ = x[RDPRU-129] - _ = x[RDRAND-130] - _ = x[RDSEED-131] - _ = x[RDTSCP-132] - _ = x[RRSBA_CTRL-133] - _ = x[RTM-134] - _ = x[RTM_ALWAYS_ABORT-135] - _ = x[SBPB-136] - _ = x[SERIALIZE-137] - _ = x[SEV-138] - _ = x[SEV_64BIT-139] - _ = x[SEV_ALTERNATIVE-140] - _ = x[SEV_DEBUGSWAP-141] - _ = x[SEV_ES-142] - _ = x[SEV_RESTRICTED-143] - _ = x[SEV_SNP-144] - _ = x[SGX-145] - _ = x[SGXLC-146] - _ = x[SGXPQC-147] - _ = x[SHA-148] - _ = x[SME-149] - _ = x[SME_COHERENT-150] - _ = x[SM3_X86-151] - _ = x[SM4_X86-152] - _ = x[SPEC_CTRL_SSBD-153] - _ = x[SRBDS_CTRL-154] - _ = x[SRSO_MSR_FIX-155] - _ = x[SRSO_NO-156] - _ = x[SRSO_USER_KERNEL_NO-157] - _ = x[SSE-158] - _ = x[SSE2-159] - _ = x[SSE3-160] - _ = x[SSE4-161] - _ = x[SSE42-162] - _ = x[SSE4A-163] - _ = x[SSSE3-164] - _ = x[STIBP-165] - _ = x[STIBP_ALWAYSON-166] - _ = x[STOSB_SHORT-167] - _ = x[SUCCOR-168] - _ = x[SVM-169] - _ = x[SVMDA-170] - _ = x[SVMFBASID-171] - _ = x[SVML-172] - _ = x[SVMNP-173] - _ = x[SVMPF-174] - _ = x[SVMPFT-175] - _ = x[SYSCALL-176] - _ = x[SYSEE-177] - _ = x[TBM-178] - _ = x[TDX_GUEST-179] - _ = x[TLB_FLUSH_NESTED-180] - _ = x[TME-181] - _ = x[TOPEXT-182] - _ = x[TSA_L1_NO-183] - _ = x[TSA_SQ_NO-184] - _ = x[TSA_VERW_CLEAR-185] - _ = x[TSCRATEMSR-186] - _ = x[TSXLDTRK-187] - _ = x[VAES-188] - _ = x[VMCBCLEAN-189] - _ = x[VMPL-190] - _ = x[VMSA_REGPROT-191] - _ = x[VMX-192] - _ = x[VPCLMULQDQ-193] - _ = x[VTE-194] - _ = x[WAITPKG-195] - _ = x[WBNOINVD-196] - _ = x[WRMSRNS-197] - _ = x[X87-198] - _ = x[XGETBV1-199] - _ = x[XOP-200] - _ = x[XSAVE-201] - _ = x[XSAVEC-202] - _ = x[XSAVEOPT-203] - _ = x[XSAVES-204] - _ = x[AESARM-205] - _ = x[ARMCPUID-206] - _ = x[ASIMD-207] - _ = x[ASIMDDP-208] - _ = x[ASIMDHP-209] - _ = x[ASIMDRDM-210] - _ = x[ATOMICS-211] - _ = x[CRC32-212] - _ = x[DCPOP-213] - _ = x[EVTSTRM-214] - _ = x[FCMA-215] - _ = x[FHM-216] - _ = x[FP-217] - _ = x[FPHP-218] - _ = x[GPA-219] - _ = x[JSCVT-220] - _ = x[LRCPC-221] - _ = x[PMULL-222] - _ = x[RNDR-223] - _ = x[TLB-224] - _ = x[TS-225] - _ = x[SHA1-226] - _ = x[SHA2-227] - _ = x[SHA3-228] - _ = x[SHA512-229] - _ = x[SM3-230] - _ = x[SM4-231] - _ = x[SVE-232] - _ = x[PMU_FIXEDCOUNTER_CYCLES-233] - _ = x[PMU_FIXEDCOUNTER_REFCYCLES-234] - _ = x[PMU_FIXEDCOUNTER_INSTRUCTIONS-235] - _ = x[PMU_FIXEDCOUNTER_TOPDOWN_SLOTS-236] - _ = x[lastID-237] + _ = x[AVX512BMM-22] + _ = x[AVX512BW-23] + _ = x[AVX512CD-24] + _ = x[AVX512DQ-25] + _ = x[AVX512ER-26] + _ = x[AVX512F-27] + _ = x[AVX512FP16-28] + _ = x[AVX512IFMA-29] + _ = x[AVX512PF-30] + _ = x[AVX512VBMI-31] + _ = x[AVX512VBMI2-32] + _ = x[AVX512VL-33] + _ = x[AVX512VNNI-34] + _ = x[AVX512VP2INTERSECT-35] + _ = x[AVX512VPOPCNTDQ-36] + _ = x[AVXIFMA-37] + _ = x[AVXNECONVERT-38] + _ = x[AVXSLOW-39] + _ = x[AVXVNNI-40] + _ = x[AVXVNNIINT8-41] + _ = x[AVXVNNIINT16-42] + _ = x[BHI_CTRL-43] + _ = x[BMI1-44] + _ = x[BMI2-45] + _ = x[CETIBT-46] + _ = x[CETSS-47] + _ = x[CLDEMOTE-48] + _ = x[CLMUL-49] + _ = x[CLZERO-50] + _ = x[CMOV-51] + _ = x[CMPCCXADD-52] + _ = x[CMPSB_SCADBS_SHORT-53] + _ = x[CMPXCHG8-54] + _ = x[CPBOOST-55] + _ = x[CPPC-56] + _ = x[CX16-57] + _ = x[EFER_LMSLE_UNS-58] + _ = x[ENQCMD-59] + _ = x[ERMS-60] + _ = x[F16C-61] + _ = x[FLUSH_L1D-62] + _ = x[FMA3-63] + _ = x[FMA4-64] + _ = x[FP128-65] + _ = x[FP256-66] + _ = x[FRED-67] + _ = x[FSRM-68] + _ = x[FXSR-69] + _ = x[FXSROPT-70] + _ = x[GFNI-71] + _ = x[HLE-72] + _ = x[HRESET-73] + _ = x[HTT-74] + _ = x[HWA-75] + _ = x[HYBRID_CPU-76] + _ = x[HYPERVISOR-77] + _ = x[IA32_ARCH_CAP-78] + _ = x[IA32_CORE_CAP-79] + _ = x[IBPB-80] + _ = x[IBPB_BRTYPE-81] + _ = x[IBRS-82] + _ = x[IBRS_PREFERRED-83] + _ = x[IBRS_PROVIDES_SMP-84] + _ = x[IBS-85] + _ = x[IBSBRNTRGT-86] + _ = x[IBSFETCHSAM-87] + _ = x[IBSFFV-88] + _ = x[IBSOPCNT-89] + _ = x[IBSOPCNTEXT-90] + _ = x[IBSOPSAM-91] + _ = x[IBSRDWROPCNT-92] + _ = x[IBSRIPINVALIDCHK-93] + _ = x[IBS_FETCH_CTLX-94] + _ = x[IBS_OPDATA4-95] + _ = x[IBS_OPFUSE-96] + _ = x[IBS_PREVENTHOST-97] + _ = x[IBS_ZEN4-98] + _ = x[IDPRED_CTRL-99] + _ = x[INT_WBINVD-100] + _ = x[INVLPGB-101] + _ = x[KEYLOCKER-102] + _ = x[KEYLOCKERW-103] + _ = x[LAHF-104] + _ = x[LAM-105] + _ = x[LBRVIRT-106] + _ = x[LZCNT-107] + _ = x[MCAOVERFLOW-108] + _ = x[MCDT_NO-109] + _ = x[MCOMMIT-110] + _ = x[MD_CLEAR-111] + _ = x[MMX-112] + _ = x[MMXEXT-113] + _ = x[MOVBE-114] + _ = x[MOVDIR64B-115] + _ = x[MOVDIRI-116] + _ = x[MOVSB_ZL-117] + _ = x[MOVU-118] + _ = x[MPX-119] + _ = x[MSRIRC-120] + _ = x[MSRLIST-121] + _ = x[MSR_PAGEFLUSH-122] + _ = x[NRIPS-123] + _ = x[NX-124] + _ = x[OSXSAVE-125] + _ = x[PCONFIG-126] + _ = x[POPCNT-127] + _ = x[PPIN-128] + _ = x[PREFETCHI-129] + _ = x[PSFD-130] + _ = x[RDPRU-131] + _ = x[RDRAND-132] + _ = x[RDSEED-133] + _ = x[RDTSCP-134] + _ = x[RRSBA_CTRL-135] + _ = x[RTM-136] + _ = x[RTM_ALWAYS_ABORT-137] + _ = x[SBPB-138] + _ = x[SERIALIZE-139] + _ = x[SEV-140] + _ = x[SEV_64BIT-141] + _ = x[SEV_ALTERNATIVE-142] + _ = x[SEV_DEBUGSWAP-143] + _ = x[SEV_ES-144] + _ = x[SEV_RESTRICTED-145] + _ = x[SEV_SNP-146] + _ = x[SGX-147] + _ = x[SGXLC-148] + _ = x[SGXPQC-149] + _ = x[SHA-150] + _ = x[SME-151] + _ = x[SME_COHERENT-152] + _ = x[SM3_X86-153] + _ = x[SM4_X86-154] + _ = x[SPEC_CTRL_SSBD-155] + _ = x[SRBDS_CTRL-156] + _ = x[SRSO_MSR_FIX-157] + _ = x[SRSO_NO-158] + _ = x[SRSO_USER_KERNEL_NO-159] + _ = x[SSE-160] + _ = x[SSE2-161] + _ = x[SSE3-162] + _ = x[SSE4-163] + _ = x[SSE42-164] + _ = x[SSE4A-165] + _ = x[SSSE3-166] + _ = x[STIBP-167] + _ = x[STIBP_ALWAYSON-168] + _ = x[STOSB_SHORT-169] + _ = x[SUCCOR-170] + _ = x[SVM-171] + _ = x[SVMDA-172] + _ = x[SVMFBASID-173] + _ = x[SVML-174] + _ = x[SVMNP-175] + _ = x[SVMPF-176] + _ = x[SVMPFT-177] + _ = x[SYSCALL-178] + _ = x[SYSEE-179] + _ = x[TBM-180] + _ = x[TDX_GUEST-181] + _ = x[TLB_FLUSH_NESTED-182] + _ = x[TME-183] + _ = x[TOPEXT-184] + _ = x[TSA_L1_NO-185] + _ = x[TSA_SQ_NO-186] + _ = x[TSA_VERW_CLEAR-187] + _ = x[TSCRATEMSR-188] + _ = x[TSXLDTRK-189] + _ = x[VAES-190] + _ = x[VMCBCLEAN-191] + _ = x[VMPL-192] + _ = x[VMSA_REGPROT-193] + _ = x[VMX-194] + _ = x[VPCLMULQDQ-195] + _ = x[VTE-196] + _ = x[WAITPKG-197] + _ = x[WBNOINVD-198] + _ = x[WRMSRNS-199] + _ = x[X87-200] + _ = x[XGETBV1-201] + _ = x[XOP-202] + _ = x[XSAVE-203] + _ = x[XSAVEC-204] + _ = x[XSAVEOPT-205] + _ = x[XSAVES-206] + _ = x[AESARM-207] + _ = x[ARMCPUID-208] + _ = x[ASIMD-209] + _ = x[ASIMDDP-210] + _ = x[ASIMDHP-211] + _ = x[ASIMDRDM-212] + _ = x[ATOMICS-213] + _ = x[CRC32-214] + _ = x[DCPOP-215] + _ = x[EVTSTRM-216] + _ = x[FCMA-217] + _ = x[FHM-218] + _ = x[FP-219] + _ = x[FPHP-220] + _ = x[GPA-221] + _ = x[JSCVT-222] + _ = x[LRCPC-223] + _ = x[PMULL-224] + _ = x[RNDR-225] + _ = x[TLB-226] + _ = x[TS-227] + _ = x[SHA1-228] + _ = x[SHA2-229] + _ = x[SHA3-230] + _ = x[SHA512-231] + _ = x[SM3-232] + _ = x[SM4-233] + _ = x[SVE-234] + _ = x[SVE2-235] + _ = x[SB-236] + _ = x[SSBS-237] + _ = x[BTI-238] + _ = x[FLAGM2-239] + _ = x[FRINTTS-240] + _ = x[DCPODP-241] + _ = x[BF16-242] + _ = x[I8MM-243] + _ = x[WFXT-244] + _ = x[MOPS-245] + _ = x[HBC-246] + _ = x[CSSC-247] + _ = x[PMU_FIXEDCOUNTER_CYCLES-248] + _ = x[PMU_FIXEDCOUNTER_REFCYCLES-249] + _ = x[PMU_FIXEDCOUNTER_INSTRUCTIONS-250] + _ = x[PMU_FIXEDCOUNTER_TOPDOWN_SLOTS-251] + _ = x[RV_IMA-252] + _ = x[RV_C-253] + _ = x[RV_F-254] + _ = x[RV_D-255] + _ = x[RV_V-256] + _ = x[RV_ZBA-257] + _ = x[RV_ZBB-258] + _ = x[RV_ZBC-259] + _ = x[RV_ZBS-260] + _ = x[RV_ZICOND-261] + _ = x[RV_ZIHINTPAUSE-262] + _ = x[RV_ZICBOM-263] + _ = x[RV_ZICBOZ-264] + _ = x[RV_ZICBOP-265] + _ = x[RV_ZFA-266] + _ = x[RV_ZFH-267] + _ = x[RV_ZFHMIN-268] + _ = x[RV_ZTSO-269] + _ = x[RV_ZACAS-270] + _ = x[RV_ZBKB-271] + _ = x[RV_ZBKC-272] + _ = x[RV_ZBKX-273] + _ = x[RV_ZKND-274] + _ = x[RV_ZKNE-275] + _ = x[RV_ZKNH-276] + _ = x[RV_ZKSED-277] + _ = x[RV_ZKSH-278] + _ = x[RV_ZKT-279] + _ = x[RV_ZKN-280] + _ = x[RV_ZKS-281] + _ = x[RV_ZVBB-282] + _ = x[RV_ZVBC-283] + _ = x[RV_ZVKB-284] + _ = x[RV_ZVKG-285] + _ = x[RV_ZVKNED-286] + _ = x[RV_ZVKNHA-287] + _ = x[RV_ZVKNHB-288] + _ = x[RV_ZVKSED-289] + _ = x[RV_ZVKSH-290] + _ = x[RV_ZVKT-291] + _ = x[RV_ZVKNG-292] + _ = x[RV_ZVKSG-293] + _ = x[lastID-294] _ = x[firstID-0] } -const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXFP16AMXINT8AMXFP8AMXTILEAMXTF32AMXCOMPLEXAMXTRANSPOSEAPX_FAVXAVX10AVX10_128AVX10_256AVX10_512AVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512FP16AVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXIFMAAVXNECONVERTAVXSLOWAVXVNNIAVXVNNIINT8AVXVNNIINT16BHI_CTRLBMI1BMI2CETIBTCETSSCLDEMOTECLMULCLZEROCMOVCMPCCXADDCMPSB_SCADBS_SHORTCMPXCHG8CPBOOSTCPPCCX16EFER_LMSLE_UNSENQCMDERMSF16CFLUSH_L1DFMA3FMA4FP128FP256FSRMFXSRFXSROPTGFNIHLEHRESETHTTHWAHYBRID_CPUHYPERVISORIA32_ARCH_CAPIA32_CORE_CAPIBPBIBPB_BRTYPEIBRSIBRS_PREFERREDIBRS_PROVIDES_SMPIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKIBS_FETCH_CTLXIBS_OPDATA4IBS_OPFUSEIBS_PREVENTHOSTIBS_ZEN4IDPRED_CTRLINT_WBINVDINVLPGBKEYLOCKERKEYLOCKERWLAHFLAMLBRVIRTLZCNTMCAOVERFLOWMCDT_NOMCOMMITMD_CLEARMMXMMXEXTMOVBEMOVDIR64BMOVDIRIMOVSB_ZLMOVUMPXMSRIRCMSRLISTMSR_PAGEFLUSHNRIPSNXOSXSAVEPCONFIGPOPCNTPPINPREFETCHIPSFDRDPRURDRANDRDSEEDRDTSCPRRSBA_CTRLRTMRTM_ALWAYS_ABORTSBPBSERIALIZESEVSEV_64BITSEV_ALTERNATIVESEV_DEBUGSWAPSEV_ESSEV_RESTRICTEDSEV_SNPSGXSGXLCSGXPQCSHASMESME_COHERENTSM3_X86SM4_X86SPEC_CTRL_SSBDSRBDS_CTRLSRSO_MSR_FIXSRSO_NOSRSO_USER_KERNEL_NOSSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSTIBP_ALWAYSONSTOSB_SHORTSUCCORSVMSVMDASVMFBASIDSVMLSVMNPSVMPFSVMPFTSYSCALLSYSEETBMTDX_GUESTTLB_FLUSH_NESTEDTMETOPEXTTSA_L1_NOTSA_SQ_NOTSA_VERW_CLEARTSCRATEMSRTSXLDTRKVAESVMCBCLEANVMPLVMSA_REGPROTVMXVPCLMULQDQVTEWAITPKGWBNOINVDWRMSRNSX87XGETBV1XOPXSAVEXSAVECXSAVEOPTXSAVESAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFHMFPFPHPGPAJSCVTLRCPCPMULLRNDRTLBTSSHA1SHA2SHA3SHA512SM3SM4SVEPMU_FIXEDCOUNTER_CYCLESPMU_FIXEDCOUNTER_REFCYCLESPMU_FIXEDCOUNTER_INSTRUCTIONSPMU_FIXEDCOUNTER_TOPDOWN_SLOTSlastID" +const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXFP16AMXINT8AMXFP8AMXTILEAMXTF32AMXCOMPLEXAMXTRANSPOSEAPX_FAVXAVX10AVX10_128AVX10_256AVX10_512AVX2AVX512BF16AVX512BITALGAVX512BMMAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512FP16AVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXIFMAAVXNECONVERTAVXSLOWAVXVNNIAVXVNNIINT8AVXVNNIINT16BHI_CTRLBMI1BMI2CETIBTCETSSCLDEMOTECLMULCLZEROCMOVCMPCCXADDCMPSB_SCADBS_SHORTCMPXCHG8CPBOOSTCPPCCX16EFER_LMSLE_UNSENQCMDERMSF16CFLUSH_L1DFMA3FMA4FP128FP256FREDFSRMFXSRFXSROPTGFNIHLEHRESETHTTHWAHYBRID_CPUHYPERVISORIA32_ARCH_CAPIA32_CORE_CAPIBPBIBPB_BRTYPEIBRSIBRS_PREFERREDIBRS_PROVIDES_SMPIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKIBS_FETCH_CTLXIBS_OPDATA4IBS_OPFUSEIBS_PREVENTHOSTIBS_ZEN4IDPRED_CTRLINT_WBINVDINVLPGBKEYLOCKERKEYLOCKERWLAHFLAMLBRVIRTLZCNTMCAOVERFLOWMCDT_NOMCOMMITMD_CLEARMMXMMXEXTMOVBEMOVDIR64BMOVDIRIMOVSB_ZLMOVUMPXMSRIRCMSRLISTMSR_PAGEFLUSHNRIPSNXOSXSAVEPCONFIGPOPCNTPPINPREFETCHIPSFDRDPRURDRANDRDSEEDRDTSCPRRSBA_CTRLRTMRTM_ALWAYS_ABORTSBPBSERIALIZESEVSEV_64BITSEV_ALTERNATIVESEV_DEBUGSWAPSEV_ESSEV_RESTRICTEDSEV_SNPSGXSGXLCSGXPQCSHASMESME_COHERENTSM3_X86SM4_X86SPEC_CTRL_SSBDSRBDS_CTRLSRSO_MSR_FIXSRSO_NOSRSO_USER_KERNEL_NOSSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSTIBP_ALWAYSONSTOSB_SHORTSUCCORSVMSVMDASVMFBASIDSVMLSVMNPSVMPFSVMPFTSYSCALLSYSEETBMTDX_GUESTTLB_FLUSH_NESTEDTMETOPEXTTSA_L1_NOTSA_SQ_NOTSA_VERW_CLEARTSCRATEMSRTSXLDTRKVAESVMCBCLEANVMPLVMSA_REGPROTVMXVPCLMULQDQVTEWAITPKGWBNOINVDWRMSRNSX87XGETBV1XOPXSAVEXSAVECXSAVEOPTXSAVESAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFHMFPFPHPGPAJSCVTLRCPCPMULLRNDRTLBTSSHA1SHA2SHA3SHA512SM3SM4SVESVE2SBSSBSBTIFLAGM2FRINTTSDCPODPBF16I8MMWFXTMOPSHBCCSSCPMU_FIXEDCOUNTER_CYCLESPMU_FIXEDCOUNTER_REFCYCLESPMU_FIXEDCOUNTER_INSTRUCTIONSPMU_FIXEDCOUNTER_TOPDOWN_SLOTSRV_IMARV_CRV_FRV_DRV_VRV_ZBARV_ZBBRV_ZBCRV_ZBSRV_ZICONDRV_ZIHINTPAUSERV_ZICBOMRV_ZICBOZRV_ZICBOPRV_ZFARV_ZFHRV_ZFHMINRV_ZTSORV_ZACASRV_ZBKBRV_ZBKCRV_ZBKXRV_ZKNDRV_ZKNERV_ZKNHRV_ZKSEDRV_ZKSHRV_ZKTRV_ZKNRV_ZKSRV_ZVBBRV_ZVBCRV_ZVKBRV_ZVKGRV_ZVKNEDRV_ZVKNHARV_ZVKNHBRV_ZVKSEDRV_ZVKSHRV_ZVKTRV_ZVKNGRV_ZVKSGlastID" -var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 61, 68, 75, 85, 97, 102, 105, 110, 119, 128, 137, 141, 151, 163, 171, 179, 187, 195, 202, 212, 222, 230, 240, 251, 259, 269, 287, 302, 309, 321, 328, 335, 346, 358, 366, 370, 374, 380, 385, 393, 398, 404, 408, 417, 435, 443, 450, 454, 458, 472, 478, 482, 486, 495, 499, 503, 508, 513, 517, 521, 528, 532, 535, 541, 544, 547, 557, 567, 580, 593, 597, 608, 612, 626, 643, 646, 656, 667, 673, 681, 692, 700, 712, 728, 742, 753, 763, 778, 786, 797, 807, 814, 823, 833, 837, 840, 847, 852, 863, 870, 877, 885, 888, 894, 899, 908, 915, 923, 927, 930, 936, 943, 956, 961, 963, 970, 977, 983, 987, 996, 1000, 1005, 1011, 1017, 1023, 1033, 1036, 1052, 1056, 1065, 1068, 1077, 1092, 1105, 1111, 1125, 1132, 1135, 1140, 1146, 1149, 1152, 1164, 1171, 1178, 1192, 1202, 1214, 1221, 1240, 1243, 1247, 1251, 1255, 1260, 1265, 1270, 1275, 1289, 1300, 1306, 1309, 1314, 1323, 1327, 1332, 1337, 1343, 1350, 1355, 1358, 1367, 1383, 1386, 1392, 1401, 1410, 1424, 1434, 1442, 1446, 1455, 1459, 1471, 1474, 1484, 1487, 1494, 1502, 1509, 1512, 1519, 1522, 1527, 1533, 1541, 1547, 1553, 1561, 1566, 1573, 1580, 1588, 1595, 1600, 1605, 1612, 1616, 1619, 1621, 1625, 1628, 1633, 1638, 1643, 1647, 1650, 1652, 1656, 1660, 1664, 1670, 1673, 1676, 1679, 1702, 1728, 1757, 1787, 1793} +var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 61, 68, 75, 85, 97, 102, 105, 110, 119, 128, 137, 141, 151, 163, 172, 180, 188, 196, 204, 211, 221, 231, 239, 249, 260, 268, 278, 296, 311, 318, 330, 337, 344, 355, 367, 375, 379, 383, 389, 394, 402, 407, 413, 417, 426, 444, 452, 459, 463, 467, 481, 487, 491, 495, 504, 508, 512, 517, 522, 526, 530, 534, 541, 545, 548, 554, 557, 560, 570, 580, 593, 606, 610, 621, 625, 639, 656, 659, 669, 680, 686, 694, 705, 713, 725, 741, 755, 766, 776, 791, 799, 810, 820, 827, 836, 846, 850, 853, 860, 865, 876, 883, 890, 898, 901, 907, 912, 921, 928, 936, 940, 943, 949, 956, 969, 974, 976, 983, 990, 996, 1000, 1009, 1013, 1018, 1024, 1030, 1036, 1046, 1049, 1065, 1069, 1078, 1081, 1090, 1105, 1118, 1124, 1138, 1145, 1148, 1153, 1159, 1162, 1165, 1177, 1184, 1191, 1205, 1215, 1227, 1234, 1253, 1256, 1260, 1264, 1268, 1273, 1278, 1283, 1288, 1302, 1313, 1319, 1322, 1327, 1336, 1340, 1345, 1350, 1356, 1363, 1368, 1371, 1380, 1396, 1399, 1405, 1414, 1423, 1437, 1447, 1455, 1459, 1468, 1472, 1484, 1487, 1497, 1500, 1507, 1515, 1522, 1525, 1532, 1535, 1540, 1546, 1554, 1560, 1566, 1574, 1579, 1586, 1593, 1601, 1608, 1613, 1618, 1625, 1629, 1632, 1634, 1638, 1641, 1646, 1651, 1656, 1660, 1663, 1665, 1669, 1673, 1677, 1683, 1686, 1689, 1692, 1696, 1698, 1702, 1705, 1711, 1718, 1724, 1728, 1732, 1736, 1740, 1743, 1747, 1770, 1796, 1825, 1855, 1861, 1865, 1869, 1873, 1877, 1883, 1889, 1895, 1901, 1910, 1924, 1933, 1942, 1951, 1957, 1963, 1972, 1979, 1987, 1994, 2001, 2008, 2015, 2022, 2029, 2037, 2044, 2050, 2056, 2062, 2069, 2076, 2083, 2090, 2099, 2108, 2117, 2126, 2134, 2141, 2149, 2157, 2163} func (i FeatureID) String() string { - if i < 0 || i >= FeatureID(len(_FeatureID_index)-1) { + idx := int(i) - 0 + if i < 0 || idx >= len(_FeatureID_index)-1 { return "FeatureID(" + strconv.FormatInt(int64(i), 10) + ")" } - return _FeatureID_name[_FeatureID_index[i]:_FeatureID_index[i+1]] + return _FeatureID_name[_FeatureID_index[idx]:_FeatureID_index[idx+1]] } func _() { // An "invalid array index" compiler error signifies that the constant values have changed. @@ -293,16 +351,22 @@ func _() { _ = x[ACRN-28] _ = x[SRE-29] _ = x[Apple-30] - _ = x[lastVendor-31] + _ = x[SiFive-31] + _ = x[StarFive-32] + _ = x[THead-33] + _ = x[Andes-34] + _ = x[SpacemiT-35] + _ = x[lastVendor-36] } -const _Vendor_name = "VendorUnknownIntelAMDVIATransmetaNSCKVMMSVMVMwareXenHVMBhyveHygonSiSRDCAmpereARMBroadcomCaviumDECFujitsuInfineonMotorolaNVIDIAAMCCQualcommMarvellQEMUQNXACRNSREApplelastVendor" +const _Vendor_name = "VendorUnknownIntelAMDVIATransmetaNSCKVMMSVMVMwareXenHVMBhyveHygonSiSRDCAmpereARMBroadcomCaviumDECFujitsuInfineonMotorolaNVIDIAAMCCQualcommMarvellQEMUQNXACRNSREAppleSiFiveStarFiveTHeadAndesSpacemiTlastVendor" -var _Vendor_index = [...]uint8{0, 13, 18, 21, 24, 33, 36, 39, 43, 49, 55, 60, 65, 68, 71, 77, 80, 88, 94, 97, 104, 112, 120, 126, 130, 138, 145, 149, 152, 156, 159, 164, 174} +var _Vendor_index = [...]uint8{0, 13, 18, 21, 24, 33, 36, 39, 43, 49, 55, 60, 65, 68, 71, 77, 80, 88, 94, 97, 104, 112, 120, 126, 130, 138, 145, 149, 152, 156, 159, 164, 170, 178, 183, 188, 196, 206} func (i Vendor) String() string { - if i < 0 || i >= Vendor(len(_Vendor_index)-1) { + idx := int(i) - 0 + if i < 0 || idx >= len(_Vendor_index)-1 { return "Vendor(" + strconv.FormatInt(int64(i), 10) + ")" } - return _Vendor_name[_Vendor_index[i]:_Vendor_index[i+1]] + return _Vendor_name[_Vendor_index[idx]:_Vendor_index[idx+1]] } diff --git a/vendor/github.com/klauspost/cpuid/v2/os_darwin_arm64.go b/vendor/github.com/klauspost/cpuid/v2/os_darwin_arm64.go index da07522e7..addbfc67b 100644 --- a/vendor/github.com/klauspost/cpuid/v2/os_darwin_arm64.go +++ b/vendor/github.com/klauspost/cpuid/v2/os_darwin_arm64.go @@ -126,4 +126,17 @@ func tryToFillCPUInfoFomSysctl(c *CPUInfo) { setFeature(c, SM3, "hw.optional.arm.FEAT_SM3") // SM3 instructions setFeature(c, SM4, "hw.optional.arm.FEAT_SM4") // SM4 instructions setFeature(c, SVE, "hw.optional.arm.FEAT_SVE") // Scalable Vector Extension + setFeature(c, SVE2, "hw.optional.arm.FEAT_SVE2") // Scalable Vector Extension 2 + setFeature(c, SB, "hw.optional.arm.FEAT_SB") // Speculation barrier + setFeature(c, SSBS, "hw.optional.arm.FEAT_SSBS") // Speculative Store Bypass Safe + setFeature(c, BTI, "hw.optional.arm.FEAT_BTI") // Branch Target Identification + setFeature(c, FLAGM2, "hw.optional.arm.FEAT_FlagM2") // Condition flag manipulation version 2 + setFeature(c, FRINTTS, "hw.optional.arm.FEAT_FRINTTS") // Floating-point to integer rounding + setFeature(c, DCPODP, "hw.optional.arm.FEAT_DPB2") // Data cache clean to Point of Deep Persistence + setFeature(c, BF16, "hw.optional.arm.FEAT_BF16") // BFloat16 instructions + setFeature(c, I8MM, "hw.optional.arm.FEAT_I8MM") // Int8 matrix multiplication + setFeature(c, WFXT, "hw.optional.arm.FEAT_WFxT") // WFE/WFI with timeout + setFeature(c, MOPS, "hw.optional.arm.FEAT_MOPS") // Memory copy and set instructions + setFeature(c, HBC, "hw.optional.arm.FEAT_HBC") // Hinted conditional branches + setFeature(c, CSSC, "hw.optional.arm.FEAT_CSSC") // Common short sequence compression } diff --git a/vendor/github.com/klauspost/cpuid/v2/os_linux_arm64.go b/vendor/github.com/klauspost/cpuid/v2/os_linux_arm64.go index d96d24438..ea9da404c 100644 --- a/vendor/github.com/klauspost/cpuid/v2/os_linux_arm64.go +++ b/vendor/github.com/klauspost/cpuid/v2/os_linux_arm64.go @@ -115,15 +115,19 @@ const ( hwcap2_POE = 1 << 63 ) +// hwcap2 holds AT_HWCAP2. Unlike hwcap, the arm64 runtime does not expose it +// through internal/cpu, so detectOS reads it from the auxiliary vector. +var hwcap2 uint + func detectOS(c *CPUInfo) bool { // For now assuming no hyperthreading is reasonable. c.LogicalCores = runtime.NumCPU() c.PhysicalCores = c.LogicalCores c.ThreadsPerCore = 1 - if hwcap == 0 { - // We did not get values from the runtime. - // Try reading /proc/self/auxv - + // hwcap is provided by the runtime through the internal/cpu.HWCap linkname, + // but the runtime does not expose HWCAP2 on arm64. Read the auxiliary vector + // directly to obtain hwcap2 (and hwcap when the linkname is unavailable). + if hwcap == 0 || hwcap2 == 0 { // From https://github.com/golang/sys const ( _AT_HWCAP = 16 @@ -132,37 +136,34 @@ func detectOS(c *CPUInfo) bool { uintSize = int(32 << (^uint(0) >> 63)) ) - buf, err := ioutil.ReadFile("/proc/self/auxv") - if err != nil { - // e.g. on android /proc/self/auxv is not accessible, so silently - // ignore the error and leave Initialized = false. On some - // architectures (e.g. arm64) doinit() implements a fallback - // readout and will set Initialized = true again. - return false - } - bo := binary.LittleEndian - for len(buf) >= 2*(uintSize/8) { - var tag, val uint - switch uintSize { - case 32: - tag = uint(bo.Uint32(buf[0:])) - val = uint(bo.Uint32(buf[4:])) - buf = buf[8:] - case 64: - tag = uint(bo.Uint64(buf[0:])) - val = uint(bo.Uint64(buf[8:])) - buf = buf[16:] - } - switch tag { - case _AT_HWCAP: - hwcap = val - case _AT_HWCAP2: - // Not used + // e.g. on android /proc/self/auxv is not accessible, so silently ignore + // the error and fall back to whatever the runtime provided. + if buf, err := ioutil.ReadFile("/proc/self/auxv"); err == nil { + bo := binary.LittleEndian + for len(buf) >= 2*(uintSize/8) { + var tag, val uint + switch uintSize { + case 32: + tag = uint(bo.Uint32(buf[0:])) + val = uint(bo.Uint32(buf[4:])) + buf = buf[8:] + case 64: + tag = uint(bo.Uint64(buf[0:])) + val = uint(bo.Uint64(buf[8:])) + buf = buf[16:] + } + switch tag { + case _AT_HWCAP: + hwcap = val + case _AT_HWCAP2: + hwcap2 = val + } } } - if hwcap == 0 { - return false - } + } + if hwcap == 0 { + // Nothing detected, e.g. on android or a restricted environment. + return false } // HWCap was populated by the runtime from the auxiliary vector. @@ -184,9 +185,9 @@ func detectOS(c *CPUInfo) bool { c.featureSet.setIf(isSet(hwcap, hwcap_JSCVT), JSCVT) c.featureSet.setIf(isSet(hwcap, hwcap_LRCPC), LRCPC) c.featureSet.setIf(isSet(hwcap, hwcap_PMULL), PMULL) - c.featureSet.setIf(isSet(hwcap, hwcap2_RNG), RNDR) - // c.featureSet.setIf(isSet(hwcap, hwcap_), TLB) - // c.featureSet.setIf(isSet(hwcap, hwcap_), TS) + c.featureSet.setIf(isSet(hwcap2, hwcap2_RNG), RNDR) + // TLB (FEAT_TLBIOS/TLBIRANGE) has no HWCAP bit; only detectable via ID registers. + c.featureSet.setIf(isSet(hwcap, hwcap_FLAGM), TS) c.featureSet.setIf(isSet(hwcap, hwcap_SHA1), SHA1) c.featureSet.setIf(isSet(hwcap, hwcap_SHA2), SHA2) c.featureSet.setIf(isSet(hwcap, hwcap_SHA3), SHA3) @@ -194,6 +195,21 @@ func detectOS(c *CPUInfo) bool { c.featureSet.setIf(isSet(hwcap, hwcap_SM3), SM3) c.featureSet.setIf(isSet(hwcap, hwcap_SM4), SM4) c.featureSet.setIf(isSet(hwcap, hwcap_SVE), SVE) + c.featureSet.setIf(isSet(hwcap, hwcap_SB), SB) + c.featureSet.setIf(isSet(hwcap, hwcap_SSBS), SSBS) + + // Features reported through the second hardware capability word (HWCAP2). + c.featureSet.setIf(isSet(hwcap2, hwcap2_SVE2), SVE2) + c.featureSet.setIf(isSet(hwcap2, hwcap2_BTI), BTI) + c.featureSet.setIf(isSet(hwcap2, hwcap2_FLAGM2), FLAGM2) + c.featureSet.setIf(isSet(hwcap2, hwcap2_FRINT), FRINTTS) + c.featureSet.setIf(isSet(hwcap2, hwcap2_DCPODP), DCPODP) + c.featureSet.setIf(isSet(hwcap2, hwcap2_BF16), BF16) + c.featureSet.setIf(isSet(hwcap2, hwcap2_I8MM), I8MM) + c.featureSet.setIf(isSet(hwcap2, hwcap2_WFXT), WFXT) + c.featureSet.setIf(isSet(hwcap2, hwcap2_MOPS), MOPS) + c.featureSet.setIf(isSet(hwcap2, hwcap2_HBC), HBC) + c.featureSet.setIf(isSet(hwcap2, hwcap2_CSSC), CSSC) // The Samsung S9+ kernel reports support for atomics, but not all cores // actually support them, resulting in SIGILL. See issue #28431. diff --git a/vendor/github.com/klauspost/cpuid/v2/os_linux_riscv64.go b/vendor/github.com/klauspost/cpuid/v2/os_linux_riscv64.go new file mode 100644 index 000000000..71919a49b --- /dev/null +++ b/vendor/github.com/klauspost/cpuid/v2/os_linux_riscv64.go @@ -0,0 +1,225 @@ +// Copyright (c) 2026 Klaus Post, released under MIT License. See LICENSE file. + +package cpuid + +import ( + "bufio" + "os" + "runtime" + "strconv" + "strings" + "unsafe" + + "golang.org/x/sys/unix" +) + +const __NR_riscv_hwprobe = 258 + +type riscvHWProbePair struct { + key int64 + value uint64 +} + +// Keys from linux/include/uapi/asm/hwprobe.h +const ( + riscv_hwprobe_key_mvendorid = 0 + riscv_hwprobe_key_marchid = 1 + riscv_hwprobe_key_mimpid = 2 + riscv_hwprobe_key_base_behavior = 3 + riscv_hwprobe_key_ima_ext_0 = 4 + riscv_hwprobe_key_cpuperf_0 = 5 + riscv_hwprobe_key_zicbom_block_size = 12 +) + +// Bits from linux/arch/riscv/include/uapi/asm/hwprobe.h +const ( + riscv_hwprobe_ima_fd = 1 << 0 + riscv_hwprobe_ima_c = 1 << 1 + riscv_hwprobe_ima_v = 1 << 2 + riscv_hwprobe_ext_zba = 1 << 3 + riscv_hwprobe_ext_zbb = 1 << 4 + riscv_hwprobe_ext_zbs = 1 << 5 + riscv_hwprobe_ext_zicboz = 1 << 6 + riscv_hwprobe_ext_zbc = 1 << 7 + riscv_hwprobe_ext_zbkb = 1 << 8 + riscv_hwprobe_ext_zbkc = 1 << 9 + riscv_hwprobe_ext_zbkx = 1 << 10 + riscv_hwprobe_ext_zknd = 1 << 11 + riscv_hwprobe_ext_zkne = 1 << 12 + riscv_hwprobe_ext_zknh = 1 << 13 + riscv_hwprobe_ext_zksed = 1 << 14 + riscv_hwprobe_ext_zksh = 1 << 15 + riscv_hwprobe_ext_zkt = 1 << 16 + riscv_hwprobe_ext_zvbb = 1 << 17 + riscv_hwprobe_ext_zvbc = 1 << 18 + riscv_hwprobe_ext_zvkb = 1 << 19 + riscv_hwprobe_ext_zvkg = 1 << 20 + riscv_hwprobe_ext_zvkned = 1 << 21 + riscv_hwprobe_ext_zvknha = 1 << 22 + riscv_hwprobe_ext_zvknhb = 1 << 23 + riscv_hwprobe_ext_zvksed = 1 << 24 + riscv_hwprobe_ext_zvksh = 1 << 25 + riscv_hwprobe_ext_zvkt = 1 << 26 + riscv_hwprobe_ext_zfh = 1 << 27 + riscv_hwprobe_ext_zfhmin = 1 << 28 + riscv_hwprobe_ext_zihintntl = 1 << 29 + riscv_hwprobe_ext_zvfh = 1 << 30 + riscv_hwprobe_ext_zvfhmin = 1 << 31 + riscv_hwprobe_ext_zfa = 1 << 32 + riscv_hwprobe_ext_ztso = 1 << 33 + riscv_hwprobe_ext_zacas = 1 << 34 + riscv_hwprobe_ext_zicond = 1 << 35 + riscv_hwprobe_ext_zihintpause = 1 << 36 + riscv_hwprobe_ext_zicbom = 1 << 55 + riscv_hwprobe_ext_zicbop = 1 << 60 +) + +func riscvHWProbe(pairs []riscvHWProbePair) int64 { + if len(pairs) == 0 { + return -1 + } + ret, _, _ := unix.Syscall6(__NR_riscv_hwprobe, + uintptr(unsafe.Pointer(&pairs[0])), + uintptr(len(pairs)), + 0, 0, 0, 0) + return int64(ret) +} + +func detectOS(c *CPUInfo) bool { + c.LogicalCores = runtime.NumCPU() + c.PhysicalCores = c.LogicalCores + c.ThreadsPerCore = 1 + + pairs := []riscvHWProbePair{ + {key: riscv_hwprobe_key_mvendorid}, + {key: riscv_hwprobe_key_marchid}, + {key: riscv_hwprobe_key_mimpid}, + {key: riscv_hwprobe_key_ima_ext_0}, + {key: riscv_hwprobe_key_zicbom_block_size}, + } + ret := riscvHWProbe(pairs) + if ret == 0 && pairs[3].value != ^uint64(0) { + detectFromHWProbe(c, pairs) + if pairs[4].value != ^uint64(0) && pairs[4].value > 0 { + c.CacheLine = int(pairs[4].value) + } + return true + } + + c.CacheLine = detectCacheLine() + return detectFromCPUInfo(c) +} + +func detectFromHWProbe(c *CPUInfo, pairs []riscvHWProbePair) { + if pairs[0].value != ^uint64(0) { + c.VendorID = riscvVendorID(pairs[0].value) + c.VendorString = c.VendorID.String() + } + if pairs[1].value != ^uint64(0) { + c.Model = int(pairs[1].value) + } + if pairs[2].value != ^uint64(0) { + c.Family = int(pairs[2].value) + } + + imaExt := pairs[3].value + + if imaExt&riscv_hwprobe_ima_fd != 0 { + c.featureSet.set(RV_D) + c.featureSet.set(RV_F) + } + c.featureSet.setIf(imaExt&riscv_hwprobe_ima_c != 0, RV_C) + c.featureSet.setIf(imaExt&riscv_hwprobe_ima_v != 0, RV_V) + + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zba != 0, RV_ZBA) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zbb != 0, RV_ZBB) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zbc != 0, RV_ZBC) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zbs != 0, RV_ZBS) + + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zicbom != 0, RV_ZICBOM) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zicboz != 0, RV_ZICBOZ) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zicbop != 0, RV_ZICBOP) + + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zicond != 0, RV_ZICOND) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zihintpause != 0, RV_ZIHINTPAUSE) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zfa != 0, RV_ZFA) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zfh != 0, RV_ZFH) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zfhmin != 0, RV_ZFHMIN) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_ztso != 0, RV_ZTSO) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zacas != 0, RV_ZACAS) + + // Scalar cryptography + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zbkb != 0, RV_ZBKB) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zbkc != 0, RV_ZBKC) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zbkx != 0, RV_ZBKX) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zknd != 0, RV_ZKND) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zkne != 0, RV_ZKNE) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zknh != 0, RV_ZKNH) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zksed != 0, RV_ZKSED) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zksh != 0, RV_ZKSH) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zkt != 0, RV_ZKT) + + // Vector cryptography + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zvbb != 0, RV_ZVBB) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zvbc != 0, RV_ZVBC) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zvkb != 0, RV_ZVKB) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zvkg != 0, RV_ZVKG) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zvkned != 0, RV_ZVKNED) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zvknha != 0, RV_ZVKNHA) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zvknhb != 0, RV_ZVKNHB) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zvksed != 0, RV_ZVKSED) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zvksh != 0, RV_ZVKSH) + c.featureSet.setIf(imaExt&riscv_hwprobe_ext_zvkt != 0, RV_ZVKT) + + // Crypto suites (combined from individual features) + c.featureSet.setIf(c.featureSet.hasSetP(rvZKNFeatures), RV_ZKN) + c.featureSet.setIf(c.featureSet.hasSetP(rvZKSFeatures), RV_ZKS) + c.featureSet.setIf(c.featureSet.hasSetP(rvZVKNFeatures), RV_ZVKNG) + c.featureSet.setIf(c.featureSet.hasSetP(rvZVKSFeatures), RV_ZVKSG) + + // Every Linux-capable riscv64 core has I, M, A base. + c.featureSet.set(RV_IMA) +} + +func detectFromCPUInfo(c *CPUInfo) bool { + f, err := os.Open("/proc/cpuinfo") + if err != nil { + return false + } + defer f.Close() + + scanner := bufio.NewScanner(f) + for scanner.Scan() { + line := scanner.Text() + fields := strings.SplitN(line, ":", 2) + if len(fields) < 2 { + continue + } + key := strings.TrimSpace(fields[0]) + value := strings.TrimSpace(fields[1]) + + switch key { + case "isa": + parseISAString(c, value) + case "mvendorid": + if vid, err := strconv.ParseUint(value, 0, 64); err == nil { + c.VendorID = riscvVendorID(vid) + c.VendorString = c.VendorID.String() + } + case "uarch": + c.BrandName = value + } + } + return scanner.Err() == nil +} + +func detectCacheLine() int { + data, err := os.ReadFile("/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size") + if err != nil { + return 0 + } + if n, err := strconv.Atoi(strings.TrimSpace(string(data))); err == nil && n > 0 { + return n + } + return 0 +} diff --git a/vendor/github.com/klauspost/cpuid/v2/os_other_arm64.go b/vendor/github.com/klauspost/cpuid/v2/os_other_arm64.go index 8733ba343..debc12392 100644 --- a/vendor/github.com/klauspost/cpuid/v2/os_other_arm64.go +++ b/vendor/github.com/klauspost/cpuid/v2/os_other_arm64.go @@ -1,7 +1,6 @@ // Copyright (c) 2020 Klaus Post, released under MIT License. See LICENSE file. //go:build arm64 && !linux && !darwin -// +build arm64,!linux,!darwin package cpuid diff --git a/vendor/github.com/klauspost/cpuid/v2/os_other_riscv64.go b/vendor/github.com/klauspost/cpuid/v2/os_other_riscv64.go new file mode 100644 index 000000000..fd86f7d05 --- /dev/null +++ b/vendor/github.com/klauspost/cpuid/v2/os_other_riscv64.go @@ -0,0 +1,14 @@ +// Copyright (c) 2026 Klaus Post, released under MIT License. See LICENSE file. + +//go:build riscv64 && !linux + +package cpuid + +import "runtime" + +func detectOS(c *CPUInfo) bool { + c.PhysicalCores = runtime.NumCPU() + c.ThreadsPerCore = 1 + c.LogicalCores = c.PhysicalCores + return false +} diff --git a/vendor/github.com/klauspost/cpuid/v2/os_safe_linux_arm64.go b/vendor/github.com/klauspost/cpuid/v2/os_safe_linux_arm64.go index f8f201b5f..5b4e8a1b3 100644 --- a/vendor/github.com/klauspost/cpuid/v2/os_safe_linux_arm64.go +++ b/vendor/github.com/klauspost/cpuid/v2/os_safe_linux_arm64.go @@ -1,7 +1,6 @@ // Copyright (c) 2021 Klaus Post, released under MIT License. See LICENSE file. //go:build nounsafe -// +build nounsafe package cpuid diff --git a/vendor/github.com/klauspost/cpuid/v2/os_unsafe_linux_arm64.go b/vendor/github.com/klauspost/cpuid/v2/os_unsafe_linux_arm64.go index 92af622eb..00158c21c 100644 --- a/vendor/github.com/klauspost/cpuid/v2/os_unsafe_linux_arm64.go +++ b/vendor/github.com/klauspost/cpuid/v2/os_unsafe_linux_arm64.go @@ -1,7 +1,6 @@ // Copyright (c) 2021 Klaus Post, released under MIT License. See LICENSE file. //go:build !nounsafe -// +build !nounsafe package cpuid diff --git a/vendor/github.com/klauspost/cpuid/v2/riscv_isa.go b/vendor/github.com/klauspost/cpuid/v2/riscv_isa.go new file mode 100644 index 000000000..5a87679bd --- /dev/null +++ b/vendor/github.com/klauspost/cpuid/v2/riscv_isa.go @@ -0,0 +1,93 @@ +// Copyright (c) 2026 Klaus Post, released under MIT License. See LICENSE file. + +package cpuid + +import "strings" + +func parseISAString(c *CPUInfo, isa string) { + isa = strings.ToLower(isa) + extMap := make(map[string]bool) + for ext := range strings.SplitSeq(isa, "_") { + ext = strings.TrimSpace(ext) + if strings.HasPrefix(ext, "rv64") { + extMap["i"] = true + for _, ch := range ext[4:] { + extMap[string(ch)] = true + } + } else if ext != "" { + extMap[ext] = true + } + } + + if extMap["g"] { + extMap["i"] = true + extMap["m"] = true + extMap["a"] = true + extMap["f"] = true + extMap["d"] = true + } + + c.featureSet.setIf(extMap["i"] && extMap["m"] && extMap["a"], RV_IMA) + c.featureSet.setIf(extMap["c"], RV_C) + c.featureSet.setIf(extMap["f"], RV_F) + c.featureSet.setIf(extMap["d"], RV_D) + c.featureSet.setIf(extMap["v"], RV_V) + c.featureSet.setIf(extMap["zihintpause"], RV_ZIHINTPAUSE) + c.featureSet.setIf(extMap["zba"], RV_ZBA) + c.featureSet.setIf(extMap["zbb"], RV_ZBB) + c.featureSet.setIf(extMap["zbc"], RV_ZBC) + c.featureSet.setIf(extMap["zbs"], RV_ZBS) + c.featureSet.setIf(extMap["zicond"], RV_ZICOND) + c.featureSet.setIf(extMap["zicbom"], RV_ZICBOM) + c.featureSet.setIf(extMap["zicboz"], RV_ZICBOZ) + c.featureSet.setIf(extMap["zicbop"], RV_ZICBOP) + c.featureSet.setIf(extMap["zfa"], RV_ZFA) + c.featureSet.setIf(extMap["zfh"], RV_ZFH) + c.featureSet.setIf(extMap["zfhmin"], RV_ZFHMIN) + c.featureSet.setIf(extMap["ztso"], RV_ZTSO) + c.featureSet.setIf(extMap["zacas"], RV_ZACAS) + + // Scalar cryptography + c.featureSet.setIf(extMap["zbkb"], RV_ZBKB) + c.featureSet.setIf(extMap["zbkc"], RV_ZBKC) + c.featureSet.setIf(extMap["zbkx"], RV_ZBKX) + c.featureSet.setIf(extMap["zknd"], RV_ZKND) + c.featureSet.setIf(extMap["zkne"], RV_ZKNE) + c.featureSet.setIf(extMap["zknh"], RV_ZKNH) + c.featureSet.setIf(extMap["zksed"], RV_ZKSED) + c.featureSet.setIf(extMap["zksh"], RV_ZKSH) + c.featureSet.setIf(extMap["zkt"], RV_ZKT) + + // Vector cryptography + c.featureSet.setIf(extMap["zvbb"], RV_ZVBB) + c.featureSet.setIf(extMap["zvbc"], RV_ZVBC) + c.featureSet.setIf(extMap["zvkb"], RV_ZVKB) + c.featureSet.setIf(extMap["zvkg"], RV_ZVKG) + c.featureSet.setIf(extMap["zvkned"], RV_ZVKNED) + c.featureSet.setIf(extMap["zvknha"], RV_ZVKNHA) + c.featureSet.setIf(extMap["zvknhb"], RV_ZVKNHB) + c.featureSet.setIf(extMap["zvksed"], RV_ZVKSED) + c.featureSet.setIf(extMap["zvksh"], RV_ZVKSH) + c.featureSet.setIf(extMap["zvkt"], RV_ZVKT) + + // Crypto suites (combined from individual features or bundle tokens) + c.featureSet.setIf(extMap["zkn"] || c.featureSet.hasSetP(rvZKNFeatures), RV_ZKN) + c.featureSet.setIf(extMap["zks"] || c.featureSet.hasSetP(rvZKSFeatures), RV_ZKS) + c.featureSet.setIf(extMap["zvkng"] || c.featureSet.hasSetP(rvZVKNFeatures), RV_ZVKNG) + c.featureSet.setIf(extMap["zvksg"] || c.featureSet.hasSetP(rvZVKSFeatures), RV_ZVKSG) +} + +var riscvVendorMap = map[uint64]Vendor{ + 0x489: SiFive, + 0x5b7: StarFive, + 0x5b1: THead, + 0x31e: Andes, + 0x710: SpacemiT, +} + +func riscvVendorID(mvendorid uint64) Vendor { + if v, ok := riscvVendorMap[mvendorid]; ok { + return v + } + return VendorUnknown +} diff --git a/vendor/github.com/mattn/go-colorable/colorable_windows.go b/vendor/github.com/mattn/go-colorable/colorable_windows.go index 2df7b8598..426a409ca 100644 --- a/vendor/github.com/mattn/go-colorable/colorable_windows.go +++ b/vendor/github.com/mattn/go-colorable/colorable_windows.go @@ -5,13 +5,13 @@ package colorable import ( "bytes" + syscall "golang.org/x/sys/windows" "io" "math" "os" "strconv" "strings" "sync" - syscall "golang.org/x/sys/windows" "unsafe" "github.com/mattn/go-isatty" @@ -93,6 +93,7 @@ type writer struct { handle syscall.Handle althandle syscall.Handle oldattr word + curattr word oldpos coord rest bytes.Buffer mutex sync.Mutex @@ -112,7 +113,7 @@ func NewColorable(file *os.File) io.Writer { var csbi consoleScreenBufferInfo handle := syscall.Handle(file.Fd()) procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - return &writer{out: file, handle: handle, oldattr: csbi.attributes, oldpos: coord{0, 0}} + return &writer{out: file, handle: handle, oldattr: csbi.attributes, curattr: csbi.attributes, oldpos: coord{0, 0}} } return file } @@ -438,7 +439,11 @@ func (w *writer) Write(data []byte) (n int, err error) { w.mutex.Lock() defer w.mutex.Unlock() var csbi consoleScreenBufferInfo - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + + if w.rest.Len() == 0 && bytes.IndexByte(data, 0x1b) == -1 { + w.out.Write(data) + return len(data), nil + } handle := w.handle @@ -517,7 +522,7 @@ loop: w.rest.Reset() break } - buf.Write([]byte(string(c))) + buf.WriteByte(c) } if m == 0 { break loop @@ -678,11 +683,11 @@ loop: procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(n), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(n), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) case 'm': - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - attr := csbi.attributes + attr := w.curattr cs := buf.String() if cs == "" { procSetConsoleTextAttribute.Call(uintptr(handle), uintptr(w.oldattr)) + w.curattr = w.oldattr continue } token := strings.Split(cs, ";") @@ -814,9 +819,12 @@ loop: attr |= backgroundBlue } } - procSetConsoleTextAttribute.Call(uintptr(handle), uintptr(attr)) } } + if attr != w.curattr { + procSetConsoleTextAttribute.Call(uintptr(handle), uintptr(attr)) + w.curattr = attr + } case 'h': var ci consoleCursorInfo cs := buf.String() @@ -834,6 +842,8 @@ loop: w.althandle = syscall.Handle(h) if w.althandle != 0 { handle = w.althandle + procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) + w.curattr = csbi.attributes } } } @@ -853,6 +863,8 @@ loop: syscall.CloseHandle(w.althandle) w.althandle = 0 handle = w.handle + procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) + w.curattr = csbi.attributes } } case 's': diff --git a/vendor/github.com/mattn/go-runewidth/SECURITY.md b/vendor/github.com/mattn/go-runewidth/SECURITY.md new file mode 100644 index 000000000..a6898ee70 --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/SECURITY.md @@ -0,0 +1,25 @@ +# Security Policy + +## Supported Versions + +The following versions of go-runewidth are currently supported with +security updates. + +| Version | Supported | +| -------- | ------------------ | +| 0.0.23 | :white_check_mark: | +| < 0.0.23 | :x: | + +## Reporting a Vulnerability + +If you discover a security vulnerability in go-runewidth, please report it +privately via GitHub's "Report a vulnerability" feature on the Security tab +of the repository (https://github.com/mattn/go-runewidth/security), or by +emailing the maintainer at mattn.jp@gmail.com. + +Please include a description of the issue, reproduction steps, and the +affected version. You can expect an initial response within one week. If +the vulnerability is accepted, a fix will be prepared and a new release +will be published; you will be credited in the release notes unless you +request otherwise. If the report is declined, you will receive an +explanation of the reasoning. diff --git a/vendor/github.com/mattn/go-runewidth/runewidth.go b/vendor/github.com/mattn/go-runewidth/runewidth.go index f6c005822..6b958fdd4 100644 --- a/vendor/github.com/mattn/go-runewidth/runewidth.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth.go @@ -2,6 +2,7 @@ package runewidth import ( "os" + "sort" "strings" "unicode/utf8" @@ -25,13 +26,19 @@ var ( ) var ( - zerowidth table // combining + nonprint merged for faster zero-width lookup - widewidth table // ambiguous + doublewidth merged for EA path + zerowidth table // combining + nonprint merged for faster zero-width lookup + widewidth table // ambiguous + doublewidth merged for EA path + eastAsianWidth widthTable + eastAsianWidth0 [0x300]byte ) func init() { zerowidth = mergeIntervals(combining, nonprint) widewidth = mergeIntervals(ambiguous, doublewidth) + eastAsianWidth = makeWidthTable(zerowidth, widewidth) + for r := range eastAsianWidth0 { + eastAsianWidth0[r] = byte(runeWidthEastAsian(rune(r))) + } handleEnv() } @@ -90,6 +97,14 @@ type interval struct { type table []interval +type widthInterval struct { + first rune + last rune + width byte +} + +type widthTable []widthInterval + func inTable(r rune, t table) bool { if r < t[0].first { return false @@ -116,6 +131,71 @@ func inTable(r rune, t table) bool { return false } +func makeWidthTable(zero, two table) widthTable { + wt := make(widthTable, 0, len(zero)+len(two)) + zi := 0 + for _, iv := range two { + start := iv.first + for zi < len(zero) && zero[zi].last < start { + zi++ + } + for i := zi; i < len(zero) && zero[i].first <= iv.last; i++ { + if start < zero[i].first { + wt = append(wt, widthInterval{start, zero[i].first - 1, 2}) + } + if start <= zero[i].last { + start = zero[i].last + 1 + } + if start > iv.last { + break + } + } + if start <= iv.last { + wt = append(wt, widthInterval{start, iv.last, 2}) + } + } + for _, iv := range zero { + wt = append(wt, widthInterval{iv.first, iv.last, 0}) + } + sort.Slice(wt, func(i, j int) bool { + return wt[i].first < wt[j].first + }) + return wt +} + +func inWidthTable(r rune, t widthTable) (int, bool) { + if r < t[0].first { + return 0, false + } + if r > t[len(t)-1].last { + return 0, false + } + + bot := 0 + top := len(t) - 1 + for top >= bot { + mid := (bot + top) >> 1 + + switch { + case t[mid].last < r: + bot = mid + 1 + case t[mid].first > r: + top = mid - 1 + default: + return int(t[mid].width), true + } + } + + return 0, false +} + +func runeWidthEastAsian(r rune) int { + if w, ok := inWidthTable(r, eastAsianWidth); ok { + return w + } + return 1 +} + var private = table{ {0x00E000, 0x00F8FF}, {0x0F0000, 0x0FFFFD}, {0x100000, 0x10FFFD}, } @@ -153,34 +233,35 @@ func (c *Condition) RuneWidth(r rune) int { } // optimized version, verified by TestRuneWidthChecksums() if !c.EastAsianWidth { - switch { - case r < 0x20: + if r < 0x20 { return 0 - case (r >= 0x7F && r <= 0x9F) || r == 0xAD: // nonprint - return 0 - case r < 0x300: - return 1 - case inTable(r, zerowidth): + } + if (r >= 0x7F && r <= 0x9F) || r == 0xAD { // nonprint return 0 - case inTable(r, doublewidth): - return 2 - default: + } + if r < 0x300 { return 1 } - } else { switch { case inTable(r, zerowidth): return 0 - case inTable(r, narrow): - return 1 - case inTable(r, widewidth): - return 2 - case !c.StrictEmojiNeutral && inTable(r, emoji): + case inTable(r, doublewidth): return 2 default: return 1 } } + + if r < 0x300 { + return int(eastAsianWidth0[r]) + } + if w, ok := inWidthTable(r, eastAsianWidth); ok { + return w + } + if !c.StrictEmojiNeutral && inTable(r, emoji) { + return 2 + } + return 1 } // CreateLUT will create an in-memory lookup table of 557056 bytes for faster operation. @@ -206,6 +287,13 @@ func (c *Condition) CreateLUT() { // StringWidth return width as you can see func (c *Condition) StringWidth(s string) (width int) { + if len(s) == 1 { + b := s[0] + if b < 0x20 || b == 0x7F { + return 0 + } + return 1 + } if len(s) > 0 && len(s) <= utf8.UTFMax { r, size := utf8.DecodeRuneInString(s) if size == len(s) { @@ -213,15 +301,19 @@ func (c *Condition) StringWidth(s string) (width int) { } } // ASCII fast path: no grapheme clustering needed for pure ASCII - if isAllASCII(s) { - for i := 0; i < len(s); i++ { - b := s[i] - if b >= 0x20 && b != 0x7F { - width++ - } + for i := 0; i < len(s); i++ { + b := s[i] + if b >= 0x80 { + goto graphemes + } + if b >= 0x20 && b != 0x7F { + width++ } - return } + return + +graphemes: + width = 0 g := graphemes.FromString(s) for g.Next() { var chWidth int @@ -236,15 +328,6 @@ func (c *Condition) StringWidth(s string) (width int) { return } -func isAllASCII(s string) bool { - for i := 0; i < len(s); i++ { - if s[i] >= 0x80 { - return false - } - } - return true -} - // Truncate return string truncated with w cells func (c *Condition) Truncate(s string, w int, tail string) string { if c.StringWidth(s) <= w { diff --git a/vendor/github.com/urfave/cli/v3/autocomplete/bash_autocomplete b/vendor/github.com/urfave/cli/v3/autocomplete/bash_autocomplete index fd08201e4..42eb17b8b 100644 --- a/vendor/github.com/urfave/cli/v3/autocomplete/bash_autocomplete +++ b/vendor/github.com/urfave/cli/v3/autocomplete/bash_autocomplete @@ -66,7 +66,7 @@ __%[1]s_bash_autocomplete() { local description="" if [[ "${line}" == *:* ]]; then - token="${line%%:*}" + token="${line%%%%:*}" description="${line#*:}" fi @@ -104,4 +104,4 @@ __%[1]s_bash_autocomplete() { fi } -complete -o bashdefault -o default -o nospace -F __%[1]s_bash_autocomplete %[1]s +complete -o bashdefault -o default -F __%[1]s_bash_autocomplete %[1]s diff --git a/vendor/github.com/urfave/cli/v3/autocomplete/fish_autocomplete b/vendor/github.com/urfave/cli/v3/autocomplete/fish_autocomplete index 6714f75e0..5f2fcd7f6 100644 --- a/vendor/github.com/urfave/cli/v3/autocomplete/fish_autocomplete +++ b/vendor/github.com/urfave/cli/v3/autocomplete/fish_autocomplete @@ -6,7 +6,11 @@ function __%[1]s_perform_completion # Extract the last arg (partial input) set -l lastArg (commandline -ct) - set -l results ($args[1] $args[2..-1] $lastArg --generate-shell-completion 2> /dev/null) + if string match -q -- "-*" $lastArg + set results ($args[1] $args[2..-1] $lastArg --generate-shell-completion 2> /dev/null) + else + set results ($args[1] $args[2..-1] --generate-shell-completion 2> /dev/null) + end # Remove trailing empty lines for line in $results[-1..1] @@ -32,4 +36,4 @@ end # Clear existing completions for %[1]s complete -c %[1]s -e # Register completion function -complete -c %[1]s -f -a '(__%[1]s_perform_completion)' \ No newline at end of file +complete -c %[1]s -f -a '(__%[1]s_perform_completion)' diff --git a/vendor/github.com/urfave/cli/v3/command.go b/vendor/github.com/urfave/cli/v3/command.go index d1a9d0575..4cd907a55 100644 --- a/vendor/github.com/urfave/cli/v3/command.go +++ b/vendor/github.com/urfave/cli/v3/command.go @@ -161,21 +161,12 @@ type Command struct { globaHelpFlagAdded bool // whether global version flag was added globaVersionFlagAdded bool + // generated root version flag + versionFlag Flag // whether this is a completion command isCompletionCommand bool -} - -// FullName returns the full name of the command. -// For commands with parents this ensures that the parent commands -// are part of the command path. -func (cmd *Command) FullName() string { - namePath := []string{} - - if cmd.parent != nil { - namePath = append(namePath, cmd.parent.FullName()) - } - - return strings.Join(append(namePath, cmd.Name), " ") + // whether this is the built-in help command + builtInHelp bool } func (cmd *Command) Command(name string) *Command { @@ -303,6 +294,9 @@ func (cmd *Command) appendFlag(fl Flag) { // VisiblePersistentFlags returns a slice of [LocalFlag] with Persistent=true and Hidden=false. func (cmd *Command) VisiblePersistentFlags() []Flag { + if cmd.isCompletionCommand { + return nil + } var flags []Flag for _, fl := range cmd.Root().Flags { pfl, ok := fl.(LocalFlag) @@ -370,6 +364,22 @@ func (cmd *Command) lFlag(name string) Flag { return nil } +func (cmd *Command) hasPersistentFlagOnAncestor(fl Flag) bool { + for pCmd := cmd.parent; pCmd != nil; pCmd = pCmd.parent { + for _, pFl := range pCmd.allFlags() { + if pFl != fl { + continue + } + + pfl, ok := pFl.(LocalFlag) + if ok && !pfl.IsLocal() { + return true + } + } + } + return false +} + func (cmd *Command) lookupFlag(name string) Flag { for _, pCmd := range cmd.Lineage() { if f := pCmd.lFlag(name); f != nil { @@ -411,7 +421,7 @@ func (cmd *Command) checkAllRequiredFlags() requiredFlagsErr { // The help and completion commands are allowed to run without // enforcement of required flags, since they do not invoke user // actions that depend on those flag values. - if cmd.Name == helpName || cmd.isCompletionCommand { + if cmd.builtInHelp || cmd.isCompletionCommand { return nil } for pCmd := cmd; pCmd != nil; pCmd = pCmd.parent { @@ -556,6 +566,39 @@ func (cmd *Command) Lineage() []*Command { return lineage } +// FullName returns the full name of the command. +// Includes parent commands separated by space. +func (cmd *Command) FullName() string { + return strings.Join(cmd.Path(), " ") +} + +// Path returns the path of command names from the root to cmd, inclusive. +// Each element is a Command.Name. Path traverses upward via parent pointers +// similar to Lineage. FullName() is equivalent to strings.Join(cmd.Path(), " "). +func (cmd *Command) Path() []string { + if cmd.parent != nil { + return append(cmd.parent.Path(), cmd.Name) + } + return []string{cmd.Name} +} + +// Walk visits cmd and every descendant. If fn returns a non-nil error, the +// walk terminates and the error is returned to the caller. +func (cmd *Command) Walk(fn func(*Command) error) error { + if fn == nil { + return nil + } + if err := fn(cmd); err != nil { + return err + } + for _, sub := range cmd.Commands { + if err := sub.Walk(fn); err != nil { + return err + } + } + return nil +} + // Count returns the num of occurrences of this flag func (cmd *Command) Count(name string) int { if cf, ok := cmd.lookupFlag(name).(Countable); ok { diff --git a/vendor/github.com/urfave/cli/v3/command_parse.go b/vendor/github.com/urfave/cli/v3/command_parse.go index 2b9a481df..939ad90b8 100644 --- a/vendor/github.com/urfave/cli/v3/command_parse.go +++ b/vendor/github.com/urfave/cli/v3/command_parse.go @@ -199,6 +199,12 @@ func (cmd *Command) parseFlags(args Args) (Args, error) { posArgs = append(posArgs, rargs...) return &stringSliceArgs{posArgs}, nil } + // When DefaultCommand is set, pass unknown flags through as positional args + // so the default command can handle them (fixes #2249) + if cmd.DefaultCommand != "" { + posArgs = append(posArgs, rargs...) + return &stringSliceArgs{posArgs}, nil + } return &stringSliceArgs{posArgs}, fmt.Errorf("%s%s", providedButNotDefinedErrMsg, flagName) } @@ -206,6 +212,10 @@ func (cmd *Command) parseFlags(args Args) (Args, error) { for index, c := range flagName { tracef("processing flag (fName=%[1]q)", string(c)) if sf := cmd.lookupFlag(string(c)); sf == nil { + if index == 0 && cmd.DefaultCommand != "" { + posArgs = append(posArgs, rargs...) + return &stringSliceArgs{posArgs}, nil + } return &stringSliceArgs{posArgs}, fmt.Errorf("%s%s", providedButNotDefinedErrMsg, flagName) } else if fb, ok := sf.(boolFlag); ok && fb.IsBoolFlag() { fv := flagVal diff --git a/vendor/github.com/urfave/cli/v3/command_run.go b/vendor/github.com/urfave/cli/v3/command_run.go index 269dd85f2..8d5907151 100644 --- a/vendor/github.com/urfave/cli/v3/command_run.go +++ b/vendor/github.com/urfave/cli/v3/command_run.go @@ -9,6 +9,8 @@ import ( "unicode" ) +type helpShownKey struct{} + func (cmd *Command) parseArgsFromStdin() ([]string, error) { type state int const ( @@ -141,13 +143,10 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context var rargs Args = &stringSliceArgs{v: osArgs} var args Args = &stringSliceArgs{rargs.Tail()} - if cmd.isCompletionCommand { - tracef("completion command detected, skipping pre-parse (cmd=%[1]q)", cmd.Name) - cmd.parsedArgs = args - return ctx, cmd.Action(ctx, cmd) - } - for _, f := range cmd.allFlags() { + if cmd.hasPersistentFlagOnAncestor(f) { + continue + } if err := f.PreParse(); err != nil { return ctx, err } @@ -164,7 +163,12 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context tracef("using post-parse arguments %[1]q (cmd=%[2]q)", args, cmd.Name) - if checkCompletions(ctx, cmd) { + if shouldRunCompletion(cmd) { + var beforeErr error + if ctx, beforeErr = runBefore(ctx, commandChain(cmd)); beforeErr != nil { + return ctx, beforeErr + } + runCompletion(ctx, cmd) return ctx, nil } @@ -173,6 +177,15 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context deferErr = err cmd.isInError = true + if cmd.checkHelp() { + ctx = context.WithValue(ctx, helpShownKey{}, true) + if cmd.parent == nil { + _ = ShowRootCommandHelp(cmd) + } else { + _ = ShowSubcommandHelp(cmd) + } + return ctx, nil + } if cmd.OnUsageError != nil { err = cmd.OnUsageError(ctx, cmd, err, cmd.parent != nil) err = cmd.handleExitCoder(ctx, err) @@ -191,10 +204,8 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context tracef("SILENTLY IGNORING ERROR running ShowRootCommandHelp %[1]v (cmd=%[2]q)", err, cmd.Name) } } else { - tracef("running ShowCommandHelp with %[1]q", cmd.Name) - if err := ShowCommandHelp(ctx, cmd, cmd.Name); err != nil { - tracef("SILENTLY IGNORING ERROR running ShowCommandHelp with %[1]q %[2]v", cmd.Name, err) - } + tracef("running ShowSubcommandHelp for %[1]q", cmd.Name) + _ = ShowSubcommandHelp(cmd) } } @@ -202,6 +213,7 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context } if cmd.checkHelp() { + ctx = context.WithValue(ctx, helpShownKey{}, true) return ctx, helpCommandAction(ctx, cmd) } else { tracef("no help is wanted (cmd=%[1]q)", cmd.Name) @@ -226,6 +238,9 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context if cmd.After != nil && !cmd.Root().shellCompletion { defer func() { + if ctx.Value(helpShownKey{}) != nil { + return + } if err := cmd.After(ctx, cmd); err != nil { err = cmd.handleExitCoder(ctx, err) @@ -246,7 +261,14 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context if cmd.OnUsageError != nil { err = cmd.OnUsageError(ctx, cmd, err, cmd.parent != nil) } else { - _ = ShowSubcommandHelp(cmd) + fmt.Fprintf(cmd.Root().ErrWriter, "Incorrect Usage: %s\n\n", err.Error()) + if cmd.parent == nil { + _ = ShowRootCommandHelp(cmd) + } else { + if err := ShowCommandHelp(ctx, cmd.parent, cmd.Name); err != nil { + _ = ShowSubcommandHelp(cmd) + } + } } return ctx, err } @@ -268,13 +290,12 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context subCmd = cmd.Command(name) if subCmd == nil { hasDefault := cmd.DefaultCommand != "" - isFlagName := slices.Contains(cmd.FlagNames(), name) if hasDefault { tracef("using default command=%[1]q (cmd=%[2]q)", cmd.DefaultCommand, cmd.Name) } - if isFlagName || hasDefault { + if hasDefault { argsWithDefault := cmd.argsWithDefaultCommand(cmd.parsedArgs) tracef("using default command args=%[1]q (cmd=%[2]q)", argsWithDefault, cmd.Name) subCmd = cmd.Command(argsWithDefault.First()) @@ -304,23 +325,12 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context // perform the command action. // // First, resolve the chain of nested commands up to the parent. - var cmdChain []*Command - for p := cmd; p != nil; p = p.parent { - cmdChain = append(cmdChain, p) - } - slices.Reverse(cmdChain) + cmdChain := commandChain(cmd) // Run Before actions in order. - for _, cmd := range cmdChain { - if cmd.Before == nil { - continue - } - if bctx, err := cmd.Before(ctx, cmd); err != nil { - deferErr = cmd.handleExitCoder(ctx, err) - return ctx, deferErr - } else if bctx != nil { - ctx = bctx - } + if ctx, err = runBefore(ctx, cmdChain); err != nil { + deferErr = err + return ctx, deferErr } // Run flag actions in order. @@ -338,7 +348,14 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context if cmd.OnUsageError != nil { err = cmd.OnUsageError(ctx, cmd, err, cmd.parent != nil) } else { - _ = ShowSubcommandHelp(cmd) + fmt.Fprintf(cmd.Root().ErrWriter, "Incorrect Usage: %s\n\n", err.Error()) + if cmd.parent == nil { + _ = ShowRootCommandHelp(cmd) + } else { + if err := ShowCommandHelp(ctx, cmd.parent, cmd.Name); err != nil { + _ = ShowSubcommandHelp(cmd) + } + } } return ctx, err } @@ -370,3 +387,26 @@ func (cmd *Command) run(ctx context.Context, osArgs []string) (_ context.Context tracef("returning deferErr (cmd=%[1]q) %[2]q", cmd.Name, deferErr) return ctx, deferErr } + +func commandChain(cmd *Command) []*Command { + var cmdChain []*Command + for p := cmd; p != nil; p = p.parent { + cmdChain = append(cmdChain, p) + } + slices.Reverse(cmdChain) + return cmdChain +} + +func runBefore(ctx context.Context, cmdChain []*Command) (context.Context, error) { + for _, cmd := range cmdChain { + if cmd.Before == nil { + continue + } + if bctx, err := cmd.Before(ctx, cmd); err != nil { + return ctx, cmd.handleExitCoder(ctx, err) + } else if bctx != nil { + ctx = bctx + } + } + return ctx, nil +} diff --git a/vendor/github.com/urfave/cli/v3/command_setup.go b/vendor/github.com/urfave/cli/v3/command_setup.go index cac4a3031..646e270ce 100644 --- a/vendor/github.com/urfave/cli/v3/command_setup.go +++ b/vendor/github.com/urfave/cli/v3/command_setup.go @@ -46,18 +46,33 @@ func (cmd *Command) setupDefaults(osArgs []string) { } if cmd.Reader == nil { - tracef("setting default Reader as os.Stdin (cmd=%[1]q)", cmd.Name) - cmd.Reader = os.Stdin + if cmd.parent != nil && cmd.parent.Reader != nil { + tracef("inheriting Reader from parent (cmd=%[1]q)", cmd.Name) + cmd.Reader = cmd.parent.Reader + } else { + tracef("setting default Reader as os.Stdin (cmd=%[1]q)", cmd.Name) + cmd.Reader = os.Stdin + } } if cmd.Writer == nil { - tracef("setting default Writer as os.Stdout (cmd=%[1]q)", cmd.Name) - cmd.Writer = os.Stdout + if cmd.parent != nil && cmd.parent.Writer != nil { + tracef("inheriting Writer from parent (cmd=%[1]q)", cmd.Name) + cmd.Writer = cmd.parent.Writer + } else { + tracef("setting default Writer as os.Stdout (cmd=%[1]q)", cmd.Name) + cmd.Writer = os.Stdout + } } if cmd.ErrWriter == nil { - tracef("setting default ErrWriter as os.Stderr (cmd=%[1]q)", cmd.Name) - cmd.ErrWriter = os.Stderr + if cmd.parent != nil && cmd.parent.ErrWriter != nil { + tracef("inheriting ErrWriter from parent (cmd=%[1]q)", cmd.Name) + cmd.ErrWriter = cmd.parent.ErrWriter + } else { + tracef("setting default ErrWriter as os.Stderr (cmd=%[1]q)", cmd.Name) + cmd.ErrWriter = os.Stderr + } } if cmd.AllowExtFlags { @@ -84,13 +99,20 @@ func (cmd *Command) setupDefaults(osArgs []string) { var localVersionFlag Flag if globalVersionFlag, ok := VersionFlag.(*BoolFlag); ok { flag := *globalVersionFlag + // Drop any alias a user flag already claims (e.g. -v + // for --verbose) so the user flag wins but --version + // still works. See #2229. + flag.Aliases = dropClashingAliases(flag.Aliases, cmd.allFlags(), flag.Name) localVersionFlag = &flag } else { localVersionFlag = VersionFlag } - cmd.appendFlag(localVersionFlag) - cmd.globaVersionFlagAdded = true + if !flagNamesInUse(cmd.allFlags(), localVersionFlag.Names()) { + cmd.appendFlag(localVersionFlag) + cmd.versionFlag = localVersionFlag + cmd.globaVersionFlagAdded = true + } } } @@ -147,11 +169,13 @@ func (cmd *Command) setupDefaults(osArgs []string) { func (cmd *Command) setupCommandGraph() { tracef("setting up command graph (cmd=%[1]q)", cmd.Name) - for _, subCmd := range cmd.Commands { - subCmd.parent = cmd - subCmd.setupSubcommand() - subCmd.setupCommandGraph() - } + _ = cmd.Walk(func(sub *Command) error { + for _, subCmd := range sub.Commands { + subCmd.parent = sub + subCmd.setupSubcommand() + } + return nil + }) } func (cmd *Command) setupSubcommand() { @@ -178,6 +202,20 @@ func (cmd *Command) setupSubcommand() { cmd.flagCategories = newFlagCategoriesFromFlags(cmd.allFlags()) } +func flagNamesInUse(flags []Flag, names []string) bool { + for _, name := range names { + for _, fl := range flags { + for _, flagName := range fl.Names() { + if flagName == name { + return true + } + } + } + } + + return false +} + func (cmd *Command) hideHelp() bool { tracef("hide help (cmd=%[1]q)", cmd.Name) for c := cmd; c != nil; c = c.parent { @@ -221,3 +259,31 @@ func (cmd *Command) ensureHelp() { } } } + +// dropClashingAliases removes aliases from `aliases` that are already +// claimed by a flag in `userFlags` (either as a primary name or as one +// of its own aliases). Aliases equal to `selfName` are kept so the +// flag's primary name doesn't accidentally remove itself. +func dropClashingAliases(aliases []string, userFlags []Flag, selfName string) []string { + if len(aliases) == 0 || len(userFlags) == 0 { + return aliases + } + taken := map[string]struct{}{} + for _, f := range userFlags { + for _, n := range f.Names() { + taken[n] = struct{}{} + } + } + kept := aliases[:0:0] + for _, a := range aliases { + if a == selfName { + kept = append(kept, a) + continue + } + if _, ok := taken[a]; ok { + continue + } + kept = append(kept, a) + } + return kept +} diff --git a/vendor/github.com/urfave/cli/v3/completion.go b/vendor/github.com/urfave/cli/v3/completion.go index de11edb40..f14b01430 100644 --- a/vendor/github.com/urfave/cli/v3/completion.go +++ b/vendor/github.com/urfave/cli/v3/completion.go @@ -4,7 +4,6 @@ import ( "context" "embed" "fmt" - "sort" "strings" ) @@ -21,6 +20,12 @@ var ( //go:embed autocomplete autoCompleteFS embed.FS + // completionShells defines the order in which the shell completion + // subcommands appear in help output. Iterating shellCompletions directly + // would use Go's randomized map order, making the listing nondeterministic. + // Keep this in sync with shellCompletions. + completionShells = []string{"bash", "zsh", "fish", "pwsh"} + shellCompletions = map[string]renderCompletion{ "bash": func(c *Command, appName string) (string, error) { b, err := autoCompleteFS.ReadFile("autocomplete/bash_autocomplete") @@ -58,45 +63,36 @@ Output the script to path/to/autocomplete/$COMMAND.ps1 an run it. ` func buildCompletionCommand(appName string) *Command { - return &Command{ - Name: completionCommandName, - Hidden: true, - Usage: "Output shell completion script for bash, zsh, fish, or Powershell", - Description: strings.ReplaceAll(completionDescription, "$COMMAND", appName), - Action: func(ctx context.Context, cmd *Command) error { - return printShellCompletion(ctx, cmd, appName) - }, + cmd := &Command{ + Name: completionCommandName, + Hidden: true, + Usage: "Output shell completion script for bash, zsh, fish, or Powershell", + Description: strings.ReplaceAll(completionDescription, "$COMMAND", appName), isCompletionCommand: true, } -} -func printShellCompletion(_ context.Context, cmd *Command, appName string) error { - var shells []string - for k := range shellCompletions { - shells = append(shells, k) + for _, shell := range completionShells { + cmd.Commands = append(cmd.Commands, buildShellCompletionSubcommand(shell, shellCompletions[shell], appName)) } - sort.Strings(shells) - - if cmd.Args().Len() == 0 { - return Exit(fmt.Sprintf("no shell provided for completion command. available shells are %+v", shells), 1) - } - s := cmd.Args().First() - - renderCompletion, ok := shellCompletions[s] - if !ok { - return Exit(fmt.Sprintf("unknown shell %s, available shells are %+v", s, shells), 1) - } - - completionScript, err := renderCompletion(cmd, appName) - if err != nil { - return Exit(err, 1) - } + return cmd +} - _, err = cmd.Writer.Write([]byte(completionScript)) - if err != nil { - return Exit(err, 1) +func buildShellCompletionSubcommand(shell string, render renderCompletion, appName string) *Command { + return &Command{ + Name: shell, + Usage: fmt.Sprintf("Output %s completion script", shell), + isCompletionCommand: true, + Action: func(ctx context.Context, cmd *Command) error { + completionScript, err := render(cmd, appName) + if err != nil { + return Exit(err, 1) + } + _, err = cmd.Root().Writer.Write([]byte(completionScript)) + if err != nil { + return Exit(err, 1) + } + return nil + }, } - - return nil } diff --git a/vendor/github.com/urfave/cli/v3/flag.go b/vendor/github.com/urfave/cli/v3/flag.go index 1b849f122..3cb9ab960 100644 --- a/vendor/github.com/urfave/cli/v3/flag.go +++ b/vendor/github.com/urfave/cli/v3/flag.go @@ -151,6 +151,23 @@ type DocGenerationMultiValueFlag interface { IsMultiValueFlag() bool } +// SchemaTyper is an optional interface for flags that can report their +// JSON Schema type for programmatic introspection. +type SchemaTyper interface { + // SchemaType returns the JSON Schema type name for the value this + // flag accepts: "boolean", "integer", "number", "string", "array", + // "object". Returns "" if the flag does not map cleanly. + SchemaType() string +} + +// SchemaItemsTyper is an optional interface for multi-value flags that +// can report the JSON Schema type of their elements. +type SchemaItemsTyper interface { + // SchemaItemsType returns the JSON Schema type of elements for + // array-type flags. Returns "" for single-value or object flags. + SchemaItemsType() string +} + // Countable is an interface to enable detection of flag values which support // repetitive flags type Countable interface { diff --git a/vendor/github.com/urfave/cli/v3/flag_bool_with_inverse.go b/vendor/github.com/urfave/cli/v3/flag_bool_with_inverse.go index 8666e2d3d..199d22c7d 100644 --- a/vendor/github.com/urfave/cli/v3/flag_bool_with_inverse.go +++ b/vendor/github.com/urfave/cli/v3/flag_bool_with_inverse.go @@ -116,7 +116,7 @@ func (bif *BoolWithInverseFlag) PostParse() error { func (bif *BoolWithInverseFlag) Set(name, val string) error { if bif.count > 0 && bif.OnlyOnce { - return fmt.Errorf("cant duplicate this flag") + return fmt.Errorf("can't duplicate this flag") } bif.hasBeenSet = true @@ -207,7 +207,7 @@ func (bif *BoolWithInverseFlag) String() string { return fmt.Sprintf("%s%s", names, out[i:]) } -// IsBoolFlag returns whether the flag doesnt need to accept args +// IsBoolFlag returns whether the flag doesn't need to accept args func (bif *BoolWithInverseFlag) IsBoolFlag() bool { return true } @@ -263,3 +263,11 @@ func (bif *BoolWithInverseFlag) IsDefaultVisible() bool { func (bif *BoolWithInverseFlag) TypeName() string { return "bool" } + +func (bif *BoolWithInverseFlag) SchemaType() string { + return "boolean" +} + +func (bif *BoolWithInverseFlag) SchemaItemsType() string { + return "" +} diff --git a/vendor/github.com/urfave/cli/v3/flag_ext.go b/vendor/github.com/urfave/cli/v3/flag_ext.go index 9972af7c5..3fb01f259 100644 --- a/vendor/github.com/urfave/cli/v3/flag_ext.go +++ b/vendor/github.com/urfave/cli/v3/flag_ext.go @@ -1,6 +1,9 @@ package cli -import "flag" +import ( + "flag" + "time" +) type extFlag struct { f *flag.Flag @@ -61,3 +64,26 @@ func (e *extFlag) GetDefaultText() string { func (e *extFlag) GetEnvVars() []string { return nil } + +func (e *extFlag) SchemaType() string { + switch e.Get().(type) { + case bool: + return "boolean" + case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64: + return "integer" + case float32, float64: + return "number" + case string: + return "string" + case time.Duration: + return "duration" + case time.Time: + return "date-time" + default: + return "" + } +} + +func (e *extFlag) SchemaItemsType() string { + return "" +} diff --git a/vendor/github.com/urfave/cli/v3/flag_impl.go b/vendor/github.com/urfave/cli/v3/flag_impl.go index 1ca295aaf..a67208c91 100644 --- a/vendor/github.com/urfave/cli/v3/flag_impl.go +++ b/vendor/github.com/urfave/cli/v3/flag_impl.go @@ -6,6 +6,7 @@ import ( "fmt" "reflect" "strings" + "time" ) // Value represents a value as used by cli. @@ -193,7 +194,7 @@ func (f *FlagBase[T, C, V]) Set(_ string, val string) error { } if f.count == 1 && f.OnlyOnce { - return fmt.Errorf("cant duplicate this flag") + return fmt.Errorf("can't duplicate this flag") } f.count++ @@ -285,6 +286,51 @@ func (f *FlagBase[T, C, V]) RunAction(ctx context.Context, cmd *Command) error { return nil } +// SchemaType returns the JSON Schema type for the flag's value type. +func (f *FlagBase[T, C, V]) SchemaType() string { + var zero T + switch any(zero).(type) { + case bool: + return "boolean" + case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64: + return "integer" + case float32, float64: + return "number" + case string: + return "string" + case time.Duration: + return "duration" + case time.Time: + return "date-time" + case []string, []int, []int8, []int16, []int32, []int64, + []uint, []uint8, []uint16, []uint32, []uint64, + []float32, []float64: + return "array" + case map[string]string: + return "object" + default: + return "" + } +} + +// SchemaItemsType returns the JSON Schema element type for slice flags. +func (f *FlagBase[T, C, V]) SchemaItemsType() string { + var zero T + t := reflect.TypeOf(zero) + if t.Kind() == reflect.Slice { + switch t.Elem().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return "integer" + case reflect.Float32, reflect.Float64: + return "number" + case reflect.String: + return "string" + } + } + return "" +} + // IsMultiValueFlag returns true if the value type T can take multiple // values from cmd line. This is true for slice and map type flags func (f *FlagBase[T, C, VC]) IsMultiValueFlag() bool { @@ -301,7 +347,7 @@ func (f *FlagBase[T, C, VC]) IsLocal() bool { return f.Local } -// IsBoolFlag returns whether the flag doesnt need to accept args +// IsBoolFlag returns whether the flag doesn't need to accept args func (f *FlagBase[T, C, VC]) IsBoolFlag() bool { bf, ok := f.value.(boolFlag) return ok && bf.IsBoolFlag() diff --git a/vendor/github.com/urfave/cli/v3/godoc-current.txt b/vendor/github.com/urfave/cli/v3/godoc-current.txt index 1e163a0cb..d680c5f54 100644 --- a/vendor/github.com/urfave/cli/v3/godoc-current.txt +++ b/vendor/github.com/urfave/cli/v3/godoc-current.txt @@ -170,7 +170,9 @@ COMMANDS:{{template "visibleCommandTemplate" .}}{{end}}{{if .VisibleFlagCategori OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}} -OPTIONS:{{template "visibleFlagTemplate" .}}{{end}} +OPTIONS:{{template "visibleFlagTemplate" .}}{{end}}{{if .VisiblePersistentFlags}} + +GLOBAL OPTIONS:{{template "visiblePersistentFlagTemplate" .}}{{end}} ` SubcommandHelpTemplate is the text template for the subcommand help topic. cli.go uses text/template to render templates. You can render custom help @@ -384,7 +386,7 @@ func (bif *BoolWithInverseFlag) GetValue() string string if the flag takes no value at all. func (bif *BoolWithInverseFlag) IsBoolFlag() bool - IsBoolFlag returns whether the flag doesnt need to accept args + IsBoolFlag returns whether the flag doesn't need to accept args func (bif *BoolWithInverseFlag) IsDefaultVisible() bool IsDefaultVisible returns true if the flag is not hidden, otherwise false @@ -405,6 +407,10 @@ func (bif *BoolWithInverseFlag) PreParse() error func (bif *BoolWithInverseFlag) RunAction(ctx context.Context, cmd *Command) error +func (bif *BoolWithInverseFlag) SchemaItemsType() string + +func (bif *BoolWithInverseFlag) SchemaType() string + func (bif *BoolWithInverseFlag) Set(name, val string) error func (bif *BoolWithInverseFlag) SetCategory(c string) @@ -606,8 +612,8 @@ func (cmd *Command) FloatSlice(name string) []float64 found func (cmd *Command) FullName() string - FullName returns the full name of the command. For commands with parents - this ensures that the parent commands are part of the command path. + FullName returns the full name of the command. Includes parent commands + separated by space. func (cmd *Command) Generic(name string) Value Generic looks up the value of a local GenericFlag, returns nil if not found @@ -689,6 +695,12 @@ func (cmd *Command) Names() []string func (cmd *Command) NumFlags() int NumFlags returns the number of flags set +func (cmd *Command) Path() []string + Path returns the path of command names from the root to cmd, inclusive. + Each element is a Command.Name. Path traverses upward via parent pointers + similar to Lineage. FullName() is equivalent to strings.Join(cmd.Path(), + " "). + func (cmd *Command) Root() *Command Root returns the Command at the root of the graph @@ -801,6 +813,10 @@ func (cmd *Command) VisiblePersistentFlags() []Flag VisiblePersistentFlags returns a slice of LocalFlag with Persistent=true and Hidden=false. +func (cmd *Command) Walk(fn func(*Command) error) error + Walk visits cmd and every descendant. If fn returns a non-nil error, + the walk terminates and the error is returned to the caller. + type CommandCategories interface { // AddCommand adds a command to a category, creating a new category if necessary. AddCommand(category string, command *Command) @@ -1000,7 +1016,7 @@ func (f *FlagBase[T, C, V]) GetValue() string string if the flag takes no value at all. func (f *FlagBase[T, C, VC]) IsBoolFlag() bool - IsBoolFlag returns whether the flag doesnt need to accept args + IsBoolFlag returns whether the flag doesn't need to accept args func (f *FlagBase[T, C, V]) IsDefaultVisible() bool IsDefaultVisible returns true if the flag is not hidden, otherwise false @@ -1032,6 +1048,12 @@ func (f *FlagBase[T, C, V]) PreParse() error func (f *FlagBase[T, C, V]) RunAction(ctx context.Context, cmd *Command) error RunAction executes flag action if set +func (f *FlagBase[T, C, V]) SchemaItemsType() string + SchemaItemsType returns the JSON Schema element type for slice flags. + +func (f *FlagBase[T, C, V]) SchemaType() string + SchemaType returns the JSON Schema type for the flag's value type. + func (f *FlagBase[T, C, V]) Set(_ string, val string) error Set applies given value from string @@ -1296,6 +1318,23 @@ type RequiredFlag interface { it allows flags required flags to be backwards compatible with the Flag interface +type SchemaItemsTyper interface { + // SchemaItemsType returns the JSON Schema type of elements for + // array-type flags. Returns "" for single-value or object flags. + SchemaItemsType() string +} + SchemaItemsTyper is an optional interface for multi-value flags that can + report the JSON Schema type of their elements. + +type SchemaTyper interface { + // SchemaType returns the JSON Schema type name for the value this + // flag accepts: "boolean", "integer", "number", "string", "array", + // "object". Returns "" if the flag does not map cleanly. + SchemaType() string +} + SchemaTyper is an optional interface for flags that can report their JSON + Schema type for programmatic introspection. + type Serializer interface { Serialize() string } diff --git a/vendor/github.com/urfave/cli/v3/help.go b/vendor/github.com/urfave/cli/v3/help.go index 1fba6edf0..4bedf87d5 100644 --- a/vendor/github.com/urfave/cli/v3/help.go +++ b/vendor/github.com/urfave/cli/v3/help.go @@ -65,11 +65,12 @@ var ArgsUsageCommandHelp = "[command]" func buildHelpCommand(withAction bool) *Command { cmd := &Command{ - Name: helpName, - Aliases: []string{helpAlias}, - Usage: UsageCommandHelp, - ArgsUsage: ArgsUsageCommandHelp, - HideHelp: true, + Name: helpName, + Aliases: []string{helpAlias}, + Usage: UsageCommandHelp, + ArgsUsage: ArgsUsageCommandHelp, + HideHelp: true, + builtInHelp: true, } if withAction { @@ -85,14 +86,22 @@ func helpCommandAction(ctx context.Context, cmd *Command) error { tracef("doing help for cmd %[1]q with args %[2]q", cmd, args) - // This action can be triggered by a "default" action of a command - // or via cmd.Run when cmd == helpCmd. So we have following possibilities + // helpCommandAction is triggered in several ways: // - // 1 $ app - // 2 $ app help - // 3 $ app foo - // 4 $ app help foo - // 5 $ app foo help + // * the command has no user-defined Action (default action fallback) + // * the --help / -h flag was parsed (via cmd.checkHelp()) + // * the "help" subcommand (or "h" alias) was dispatched + // + // Possible invocations: + // + // $ app # default action; show root help + // $ app --help / -h # flag; show root help (ignores subsequent args) + // $ app help / h # subcommand; show root help + // $ app help / h foo # subcommand; show help for subcommand "foo" + // $ app --help / -h foo # flag; show help for subcommand "foo" + // $ app foo --help / -h # flag on subcommand; show help for "foo" + // $ app foo help / h # subcommand on subcommand; show help for "foo" + // $ app foo (no action) # default action on subcommand; show help for "foo" // Case 4. when executing a help command set the context to parent // to allow resolution of subsequent args. This will transform @@ -100,7 +109,7 @@ func helpCommandAction(ctx context.Context, cmd *Command) error { // to // $ app foo // which will then be handled as case 3 - if cmd.parent != nil && (cmd.HasName(helpName) || cmd.HasName(helpAlias)) { + if cmd.parent != nil && cmd.builtInHelp { tracef("setting cmd to cmd.parent") cmd = cmd.parent } @@ -459,13 +468,7 @@ func DefaultPrintHelp(out io.Writer, templ string, data any) { } func checkVersion(cmd *Command) bool { - found := false - for _, name := range VersionFlag.Names() { - if cmd.Bool(name) { - found = true - } - } - return found + return cmd.versionFlag != nil && cmd.versionFlag.IsSet() } func checkShellCompleteFlag(c *Command, arguments []string) (bool, []string) { @@ -492,7 +495,7 @@ func checkShellCompleteFlag(c *Command, arguments []string) (bool, []string) { return true, arguments[:pos] } -func checkCompletions(ctx context.Context, cmd *Command) bool { +func shouldRunCompletion(cmd *Command) bool { tracef("checking completions on command %[1]q", cmd.Name) if !cmd.Root().shellCompletion { @@ -509,13 +512,14 @@ func checkCompletions(ctx context.Context, cmd *Command) bool { } tracef("no subcommand found for completion %[1]q", cmd.Name) + return true +} +func runCompletion(ctx context.Context, cmd *Command) { if cmd.ShellComplete != nil { tracef("running shell completion func for command %[1]q", cmd.Name) cmd.ShellComplete(ctx, cmd) } - - return true } func subtract(a, b int) int { diff --git a/vendor/github.com/urfave/cli/v3/mkdocs-requirements.txt b/vendor/github.com/urfave/cli/v3/mkdocs-requirements.txt index d7f1b2c69..701403ae5 100644 --- a/vendor/github.com/urfave/cli/v3/mkdocs-requirements.txt +++ b/vendor/github.com/urfave/cli/v3/mkdocs-requirements.txt @@ -1,4 +1,4 @@ -mkdocs-git-revision-date-localized-plugin==1.5.1 +mkdocs-git-revision-date-localized-plugin==1.5.3 mkdocs-material==9.7.6 mkdocs==1.6.1 mkdocs-redirects==1.2.3 diff --git a/vendor/github.com/urfave/cli/v3/mkdocs.yml b/vendor/github.com/urfave/cli/v3/mkdocs.yml index e1eac9587..4539a73a4 100644 --- a/vendor/github.com/urfave/cli/v3/mkdocs.yml +++ b/vendor/github.com/urfave/cli/v3/mkdocs.yml @@ -20,6 +20,8 @@ nav: - v3 Manual: - Getting Started: v3/getting-started.md - Migrating From Older Releases: v3/migrating-from-older-releases.md + - Path and Walk: v3/path-and-walk.md + - Binary Size: v3/binary-size.md - Examples: - Greet: v3/examples/greet.md - Flags: diff --git a/vendor/github.com/urfave/cli/v3/template.go b/vendor/github.com/urfave/cli/v3/template.go index dd144e77d..92030cc8f 100644 --- a/vendor/github.com/urfave/cli/v3/template.go +++ b/vendor/github.com/urfave/cli/v3/template.go @@ -107,7 +107,9 @@ COMMANDS:{{template "visibleCommandTemplate" .}}{{end}}{{if .VisibleFlagCategori OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}} -OPTIONS:{{template "visibleFlagTemplate" .}}{{end}} +OPTIONS:{{template "visibleFlagTemplate" .}}{{end}}{{if .VisiblePersistentFlags}} + +GLOBAL OPTIONS:{{template "visiblePersistentFlagTemplate" .}}{{end}} ` var FishCompletionTemplate = `# {{ .Command.Name }} fish shell completion diff --git a/vendor/modules.txt b/vendor/modules.txt index ef167bb75..3b7ea5b15 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -49,8 +49,8 @@ github.com/Scalingo/go-scalingo/v11/scalingomock # github.com/Scalingo/go-utils/errors/v3 v3.2.1 ## explicit; go 1.24 github.com/Scalingo/go-utils/errors/v3 -# github.com/Scalingo/go-utils/logger v1.12.1 -## explicit; go 1.25 +# github.com/Scalingo/go-utils/logger v1.12.2 +## explicit; go 1.25.0 github.com/Scalingo/go-utils/logger # github.com/Scalingo/go-utils/pagination v1.2.0 ## explicit; go 1.24 @@ -77,8 +77,8 @@ github.com/clipperhouse/displaywidth # github.com/clipperhouse/uax29/v2 v2.7.0 ## explicit; go 1.18 github.com/clipperhouse/uax29/v2/graphemes -# github.com/cloudflare/circl v1.6.3 -## explicit; go 1.22.0 +# github.com/cloudflare/circl v1.6.4 +## explicit; go 1.24.0 github.com/cloudflare/circl/dh/x25519 github.com/cloudflare/circl/dh/x448 github.com/cloudflare/circl/ecc/goldilocks @@ -91,7 +91,7 @@ github.com/cloudflare/circl/math/mlsbset github.com/cloudflare/circl/sign github.com/cloudflare/circl/sign/ed25519 github.com/cloudflare/circl/sign/ed448 -# github.com/cyphar/filepath-securejoin v0.6.1 +# github.com/cyphar/filepath-securejoin v0.7.0 ## explicit; go 1.18 github.com/cyphar/filepath-securejoin github.com/cyphar/filepath-securejoin/internal/consts @@ -216,16 +216,16 @@ github.com/kelseyhightower/envconfig # github.com/kevinburke/ssh_config v1.6.0 ## explicit; go 1.18 github.com/kevinburke/ssh_config -# github.com/klauspost/cpuid/v2 v2.3.0 -## explicit; go 1.22 +# github.com/klauspost/cpuid/v2 v2.4.0 +## explicit; go 1.24.0 github.com/klauspost/cpuid/v2 -# github.com/mattn/go-colorable v0.1.14 +# github.com/mattn/go-colorable v0.1.15 ## explicit; go 1.18 github.com/mattn/go-colorable # github.com/mattn/go-isatty v0.0.22 ## explicit; go 1.21 github.com/mattn/go-isatty -# github.com/mattn/go-runewidth v0.0.23 +# github.com/mattn/go-runewidth v0.0.24 ## explicit; go 1.20 github.com/mattn/go-runewidth # github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d @@ -281,7 +281,7 @@ github.com/stretchr/testify/require # github.com/stvp/rollbar v0.5.1 ## explicit github.com/stvp/rollbar -# github.com/urfave/cli/v3 v3.9.0 +# github.com/urfave/cli/v3 v3.10.1 ## explicit; go 1.22 github.com/urfave/cli/v3 # github.com/xanzy/ssh-agent v0.3.3