diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..3746cac --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,10 @@ +# The files that can weaken the Go-TOPS gate (GO_TOPS.md §11). An edit to any +# of them is a change to the gate and needs the owner's review. +# GitHub ignores a line whose owner lacks write access: the CODEOWNERS errors +# API must return {"errors": []} before this file is a real gate. + +/go-tops.yaml @VirtualMachinist +/go-tops.lock @VirtualMachinist +/.go-tops/ @VirtualMachinist +/tools/ @VirtualMachinist +/.github/workflows/go-tops.yml @VirtualMachinist diff --git a/.github/workflows/go-tops.yml b/.github/workflows/go-tops.yml new file mode 100644 index 0000000..b3f95d7 --- /dev/null +++ b/.github/workflows/go-tops.yml @@ -0,0 +1,293 @@ +name: go-tops + +# The Go-TOPS drop-in (GO_TOPS.md §11): one job. On a push or a pull request each +# leg runs the gate and judges it (ruling C9: until the required laws are judged, +# the gate exits 1 on them alone, and that is a pass). When the workflow is +# dispatched by hand, only the ubuntu leg acts: it is the ledger leg, and it writes +# or refreshes the ledger instead of running the gate (GO_TOPS.md §6.7). Every +# action is pinned by commit SHA (the comment names the release), and the job only +# reads. + +on: + pull_request: + push: + branches: [main] + workflow_dispatch: + inputs: + mode: + description: "init writes the first ledger; refresh lowers the entries of the committed one" + type: choice + options: [init, refresh] + default: init + +permissions: + contents: read + +concurrency: + group: go-tops-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + gate: + name: gate (${{ matrix.leg }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + include: + - { leg: ubuntu, os: ubuntu-latest, go: "1.27.4", lint_platform: linux-amd64 } + - { leg: macos, os: macos-latest, go: "1.27.4", lint_platform: darwin-arm64 } + - { leg: floor, os: ubuntu-latest, go: "1.27.0" } + steps: + # A manual dispatch runs the ubuntu leg only: the other legs skip every step. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + if: github.event_name != 'workflow_dispatch' || matrix.leg == 'ubuntu' + with: + fetch-depth: 0 + persist-credentials: false + - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 + if: github.event_name != 'workflow_dispatch' || matrix.leg == 'ubuntu' + with: + go-version: ${{ matrix.go }} + cache-dependency-path: | + go.sum + tools/go.sum + # The gate runs golangci-lint from .go-tops/bin or PATH (GO_TOPS.md §10), so it + # is installed before the gate. The archive is checked against the SHA-256 + # pinned here, the same value as go-tops.lock for the platform, and the gate + # checks the installed executable against the lock before it runs it. A bump + # is a new hash here and a reviewed change to the lock. + - name: install golangci-lint v2.15.0 + if: matrix.leg != 'floor' && (github.event_name != 'workflow_dispatch' || matrix.leg == 'ubuntu') + env: + VERSION: "2.15.0" + PLATFORM: ${{ matrix.lint_platform }} + run: | + set -euo pipefail + case "$PLATFORM" in + linux-amd64) sha=9b7fe6a6bf6334b98decf8d86b11415ea7889afdabdd1959fdce23af2a9ebcea ;; + darwin-arm64) sha=d1e409481a8ca846c4bc97e781eb5cb1bd5c23353a0b3977a1cbda1b1b6447d5 ;; + *) echo "::error::no pinned hash for $PLATFORM"; exit 1 ;; + esac + archive="$RUNNER_TEMP/golangci-lint.tar.gz" + curl --fail --silent --show-error --location --output "$archive" \ + "https://github.com/golangci/golangci-lint/releases/download/v$VERSION/golangci-lint-$VERSION-$PLATFORM.tar.gz" + echo "$sha $archive" | shasum -a 256 -c - + mkdir -p "$RUNNER_TEMP/golangci-lint" + tar -xzf "$archive" --strip-components=1 -C "$RUNNER_TEMP/golangci-lint" + echo "$RUNNER_TEMP/golangci-lint" >> "$GITHUB_PATH" + # setup-go installs the latest release of the floor language version; this + # step proves the floor leg runs it and not another toolchain. + - name: toolchain is the floor release + if: matrix.leg == 'floor' && github.event_name != 'workflow_dispatch' + run: | + set -euo pipefail + got="$(go env GOVERSION)" + echo "GOVERSION=${got}" + case "${got}" in + go1.27.0|go1.27.0.*) ;; + *) echo "::error::the floor leg runs ${got}, not a go1.27.0 release"; exit 1 ;; + esac + # The first ledger (GO_TOPS.md section 6.7). A repository adopting Go-TOPS has no + # ledger on its default branch and cannot run the workflow by hand until the + # workflow is on that branch, so the ubuntu leg, the ledger leg, writes the first + # ledger on a pull request. `baseline --status` prints one JSON line and exits 0 + # for first-ledger-due (enforce is ratchet and neither the base nor this tree has a + # ledger), 1 for present, deleted or not-ratchet (enforce is advisory or hard), and + # 2 with state error when it cannot tell. The + # step reads the state from that line and acts only on a code and a state that + # agree: due writes the ledger on this leg's own build, uploads it as + # go-tops-baseline and fails the run until that file is committed, unchanged; + # proceed runs the gate and its judge; anything else, a missing or unknown state + # included, fails the run on the ubuntu leg. The macOS leg asks too, and while a + # first ledger is due it runs no gate, which would only fail on the missing ledger: + # the ubuntu leg fails the run. The step records the exit code with set +e, so + # bash -e does not abort on the status exit 1 or 2. The status reads the base that + # go-tops.yaml configures, as the gate does, so both answer for the same diff. + - name: is a first ledger due (baseline --status) + id: status + if: matrix.leg != 'floor' && github.event_name == 'pull_request' + env: + GOTOOLCHAIN: local + run: | + set +e + line="$(go tool -modfile=tools/go.mod gotops baseline --status)" + code=$? # 0 due, 1 not due, 2 cannot tell: read before any later command + echo "$line" + state="$(printf '%s\n' "$line" | jq -e -r .state 2>/dev/null)" || state="" + case "$code:$state" in + 0:first-ledger-due) action=due ;; + 1:present | 1:deleted | 1:not-ratchet) action=proceed ;; + *) action=stop ;; + esac + { + echo "code=$code" + echo "state=$state" + echo "action=$action" + } >> "$GITHUB_OUTPUT" + exit 0 + - name: baseline --status could not tell + if: matrix.leg == 'ubuntu' && github.event_name == 'pull_request' && steps.status.outputs.action != 'due' && steps.status.outputs.action != 'proceed' + env: + STATUS_CODE: ${{ steps.status.outputs.code }} + STATUS_STATE: ${{ steps.status.outputs.state }} + run: | + echo "::error::gotops baseline --status exited '$STATUS_CODE' with the state '$STATUS_STATE': it could not tell whether a first ledger is due, so the run fails closed" + exit 1 + - name: write the first ledger on the ledger leg + if: matrix.leg == 'ubuntu' && steps.status.outputs.action == 'due' + env: + GOTOOLCHAIN: local + run: go tool -modfile=tools/go.mod gotops baseline --init + - name: upload the first ledger as go-tops-baseline + if: matrix.leg == 'ubuntu' && steps.status.outputs.action == 'due' + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: go-tops-baseline + # .go-tops is a hidden directory, which the action skips by default. + path: .go-tops/baseline.json + include-hidden-files: true + if-no-files-found: error + - name: a first ledger is due, and the ubuntu leg writes it + if: matrix.leg == 'macos' && steps.status.outputs.action == 'due' + run: | + echo "::notice::this repository has no ledger yet: the ubuntu leg writes the first one and fails the run until it is committed, so this leg runs no gate" + - name: the first ledger is written, not committed + if: matrix.leg == 'ubuntu' && steps.status.outputs.action == 'due' + run: | + echo "::error::this repository has no ledger. The ledger leg wrote one and uploaded it as the go-tops-baseline artifact of this run: download it, commit .go-tops/baseline.json unchanged and push. The run fails until that file is committed." + exit 1 + # The gate leg: gotops runs every layer. The step records the exit code and + # does not fail on it; the next step judges it (ruling C9). + - name: gate + id: gate + if: matrix.leg != 'floor' && github.event_name != 'workflow_dispatch' && steps.status.outputs.action != 'due' + env: + GOTOOLCHAIN: local + run: | + set +e + go tool -modfile=tools/go.mod gotops gate + code=$? + echo "code=${code}" >> "$GITHUB_OUTPUT" + exit 0 + # Judge the gate on every gate leg, from the report and the exit code (GO_TOPS.md + # section 3.3, ruling C9). Exit 0 and exit 1 are both read against the report: + # every layer in range ran and is pass or skip, the run is not partial, and the + # only failed item, if any, is the required laws, all reported not evaluated, + # with no law judged and none refused (the laws are judged from M5). An exit 0 + # with a failed layer (an advisory run) or from a partial run is not a pass. Any + # other exit code is a failure. The ratchet is judged on the ledger leg only + # (GO_TOPS.md section 6.7); this repository's ledger leg is the ubuntu leg, so + # it must report pass, and the other gate legs pass or skip, a skip only when + # the run's build differs from the ledger's (ruling C3b): a skip on the ledger's + # own build judged nothing. If the ledger leg reports skip, the baseline was + # recorded under a build no leg runs. The step fails closed: a missing exit + # code (a step before the gate failed), a missing report, a report that is not + # JSON and a missing field are failures. + - name: judge the gate (ruling C9) and the ratchet on the ledger leg + if: always() && matrix.leg != 'floor' && github.event_name != 'workflow_dispatch' && steps.status.outputs.action != 'due' + env: + GATE_EXIT: ${{ steps.gate.outputs.code }} + LEG: ${{ matrix.leg }} + STATUS_STATE: ${{ steps.status.outputs.state }} + run: | + set -uo pipefail + report=.go-tops/report.json + fail() { echo "::error::$*"; exit 1; } + case "${GATE_EXIT:-}" in + 0|1) ;; + "") fail "the gate step recorded no exit code: a step before it failed, so the gate did not run" ;; + *) + case "$GATE_EXIT:${STATUS_STATE:-}" in + 2:deleted) fail "the gate exited 2 and the ledger was deleted: deleting the ledger is not a reset: restore .go-tops/baseline.json from the base or HEAD, because a ledger changes only through gotops baseline." ;; + 2:*) fail "the gate exited 2: a configuration or custody error: go-tops.yaml or go-tops.lock is invalid, a pinned tool does not match the lock, or the ledger is missing or differs from HEAD. The log above names it; gotops check and gotops lock --verify show it locally." ;; + 3:*) fail "the gate exited 3: an environment error: the repository or a tool could not be read, or no C compiler is available for cgo. The log above names it." ;; + 4:*) fail "the gate exited 4: refused in CI: a dry run or a range that leaves a required law out is not run in CI." ;; + *) fail "the gate exited $GATE_EXIT, which the protocol gives no meaning: not a verdict" ;; + esac ;; + esac + test -f "$report" || fail "the gate wrote no ${report}" + jq -e 'type == "object"' "$report" > /dev/null 2>&1 || fail "${report} is not a JSON report" + enforce="$(jq -e -r .enforce "$report")" || fail "the report names no enforce mode" + outcome="" + if [ "$enforce" = ratchet ]; then + outcome="$(jq -e -r .ratchet.outcome "$report")" || fail "the report has no ratchet outcome under enforce: ratchet" + case "$LEG:$outcome" in + ubuntu:pass|macos:pass|macos:skip) ;; + ubuntu:fail) fail "the ratchet fails: a function is over its ledger entry" ;; + ubuntu:*) fail "the ubuntu leg is the ledger leg but reports a ratchet outcome of $outcome: the baseline was recorded under another build. The first ledger comes from the pull-request run of this leg, which writes it on this leg's own build when none exists. To replace a ledger recorded under another build, run the workflow by hand with mode init or refresh after the workflow is on the default branch, and commit the file it uploads." ;; + *) fail "the ratchet outcome is $outcome on the $LEG leg" ;; + esac + fi + if [ "$outcome" = skip ]; then + jq -e '(.ratchet.ledger_build | .tags |= sort) != (.ratchet.run_build | .tags |= sort)' "$report" > /dev/null \ + || fail "the ratchet was skipped on the ledger's own build, or the report names no builds, so it judged nothing (C3b)" + fi + jq -e --argjson code "$GATE_EXIT" ' + ([.layers[] | select(.outcome != "pass" and .outcome != "skip")] | length) == 0 + and .summary.outcome != "partial" + and (.layer_counts.ran | type) == "number" + and .layer_counts.ran == .layer_counts.enabled_in_range + and ((.summary.failed - ["laws"]) | length) == 0 + and .summary.exit_code == $code + and ($code == 0 or (.summary.failed | length) > 0) + and (if (.summary.failed | any(. == "laws")) then + .laws.required > 0 + and .laws.required == .laws.required_not_evaluated + and .laws.judged == 0 + and ([.laws.results[] | select(.verdict == "refuse")] | length) == 0 + else true end) + ' "$report" > /dev/null || fail "the gate report is not a pass under ruling C9: the gate exited $GATE_EXIT and its report says another exit code, a layer failed or did not run, the run was partial, or something besides the required laws (all reported not evaluated, none judged, none refused) failed" + # The floor leg builds and tests on the floor toolchain. The gate itself + # runs on the other legs: a narrowed gate run leaves laws out of range. + - name: build and test on the floor + if: matrix.leg == 'floor' && github.event_name != 'workflow_dispatch' + env: + GOTOOLCHAIN: local + CGO_ENABLED: "1" + run: | + go build ./... + go test -race -shuffle=on -count=1 ./... + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + if: always() && matrix.leg != 'floor' && github.event_name != 'workflow_dispatch' + with: + name: go-tops-${{ matrix.leg }} + # Hidden files are off by default and .go-tops is a hidden directory; + # the downloaded binaries in .go-tops/bin are not an artifact. + path: | + .go-tops/ + !.go-tops/bin/ + include-hidden-files: true + if-no-files-found: warn + # Run this workflow by hand (workflow_dispatch) to write or refresh the ledger + # on the ledger leg's build: the ubuntu runner and toolchain of the gate leg, + # with the pinned golangci-lint installed above, because the feeding layers + # read its output. Download the artifact and commit .go-tops/baseline.json. + # init refuses when a ledger exists; refresh only lowers entries. + # --accept-regression is not run here: raise or add an entry by hand, on the + # ledger leg's build (GO_TOPS.md item 6). The input picks a step; it is never + # put into a command. + - name: write the first ledger + if: github.event_name == 'workflow_dispatch' && matrix.leg == 'ubuntu' && inputs.mode == 'init' + env: + GOTOOLCHAIN: local + run: go tool -modfile=tools/go.mod gotops baseline --init + - name: refresh the ledger + if: github.event_name == 'workflow_dispatch' && matrix.leg == 'ubuntu' && inputs.mode == 'refresh' + env: + GOTOOLCHAIN: local + run: | + go tool -modfile=tools/go.mod gotops baseline + if git diff --quiet -- .go-tops/baseline.json; then + echo "unchanged: same ledger uploaded" + fi + - name: upload the ledger as go-tops-baseline + if: github.event_name == 'workflow_dispatch' && matrix.leg == 'ubuntu' + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: go-tops-baseline + # .go-tops is a hidden directory, which the action skips by default. + path: .go-tops/baseline.json + include-hidden-files: true + if-no-files-found: error diff --git a/.gitignore b/.gitignore index fb46f29..81ab72c 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,11 @@ coverage.txt .idea/ .vscode/ *.swp + +# go-tops:begin (written by gotops init; edit outside these lines) +.go-tops/* +!.go-tops/baseline.json +!.go-tops/acks.yaml +!.go-tops/survivors.yaml +!.go-tops/golangci.yml +# go-tops:end diff --git a/.go-tops/baseline.json b/.go-tops/baseline.json new file mode 100644 index 0000000..5188f64 --- /dev/null +++ b/.go-tops/baseline.json @@ -0,0 +1,40 @@ +{ + "build": { + "cgo_enabled": true, + "goarch": "amd64", + "goos": "linux", + "tags": [] + }, + "judged_laws": 0, + "ledger": { + "findings": { + "errcheck": { + "cmd/vigil/cli.go": 3, + "cmd/vigil/main_test.go": 4, + "cmd/vigil/nolistener_test.go": 1, + "cmd/vigil/wire_grafana_test.go": 2, + "cmd/vigil/wire_test.go": 3, + "internal/config/config_test.go": 3, + "internal/exitcode/error_test.go": 1, + "internal/exitcode/exitcode_test.go": 1, + "internal/exitcode/semantics_names_test.go": 1, + "internal/grafana/grafana_test.go": 4, + "internal/httpx/httpx_test.go": 15, + "internal/promclient/promclient_test.go": 6, + "internal/render/render_test.go": 10, + "internal/schematest/schematest_test.go": 8, + "internal/sources/sources_test.go": 2 + } + }, + "functions": { + "github.com/Hedronite/vigil/cmd/vigil.newRoot": 14, + "github.com/Hedronite/vigil/internal/config.Config.validate": 41.88184531464335, + "github.com/Hedronite/vigil/internal/config.Overlay.validate": 12.144, + "github.com/Hedronite/vigil/internal/config.checkAddress": 11.968, + "github.com/Hedronite/vigil/internal/httpx.Client.Get": 14.030955718318758, + "github.com/Hedronite/vigil/internal/httpx.parseBase": 12, + "github.com/Hedronite/vigil/internal/httpx.validPath": 14, + "github.com/Hedronite/vigil/internal/promclient.Query": 23.085848234410218 + } + } +} diff --git a/.go-tops/golangci.yml b/.go-tops/golangci.yml new file mode 100644 index 0000000..0e84bef --- /dev/null +++ b/.go-tops/golangci.yml @@ -0,0 +1,34 @@ +# The lint config of the kit's hygiene layer (GO_TOPS.md §4.1, §8.1), read through +# gates.hygiene.golangci_lint.config. The repository's own .golangci.yml is not +# read by the gate and is never written or changed by gotops init: the gate counts +# findings under these rules, and the repository's own lint job keeps its own. The +# errcheck settings match the law pass. Paths in the findings are relative to the +# module (gomod), whatever the directory of this file or the one the gate runs in: +# an anchored exclusion applies only under gomod. +version: "2" + +run: + relative-path-mode: gomod + +linters: + default: standard + enable: + - depguard + settings: + depguard: + rules: + main: + deny: + - pkg: io/ioutil + desc: deprecated since Go 1.16; use os and io + - pkg: github.com/pkg/errors + desc: archived; use errors and fmt.Errorf with %w + errcheck: + check-blank: true + check-type-assertions: true + exclude-functions: + - (io.ReadCloser).Close + +formatters: + enable: + - gofmt diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..d461520 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,100 @@ + +# AGENTS.md — Go-TOPS Agent Contract + +This file is the contract between this repository and any AI coding agents (or human reviewers) working on it. + +**Class:** `binary-service` +**Protocol:** Go-TOPS 0.4.4 +**Module:** `github.com/Hedronite/vigil` +**Enforce:** `ratchet` + +## Commands + +```bash +# Validate config +go tool -modfile=tools/go.mod gotops check + +# Run the merge gate (tier ≤ 1) +go tool -modfile=tools/go.mod gotops gate + +# Full reports +go tool -modfile=tools/go.mod gotops report --format text +``` + +## Floors (this class) + +- Statement coverage ≥ `75%` +- CRAP cap ≤ `10`, the same for every author +- Error guards that only return the error count 0 toward complexity (`err_guard_discount: true`) +- Unexplained mutation survivors: none (`unexplained_survivors_max` is 0), on lines changed against `origin/main` +- Race detector: required (test jobs run with `CGO_ENABLED=1`; `-race` needs cgo on Linux) +- Under `ratchet`: a function over the cap may not exceed its score in `.go-tops/baseline.json` plus 0.01, and every other function meets the cap. A package under its floor fails only if its coverage percentage falls and its uncovered-statement count rises. No per-file count of lint findings, law findings, `//nolint` or `//tops:ack` comments, or unexplained survivors, and no repo exemption count, rises above its baseline entry. Only `gotops baseline` writes the baseline +- Other class layers: see `go-tops.yaml` + +## Policies (non-negotiable) + +1. Write the oracle from the contract before the code. +2. Never split a function only to lower its CRAP score (scar-guard). +3. Never weaken a law, linter config, or threshold to make a change pass. +4. Explain every accepted mutation survivor (reason, owner, expiry). +5. No `//nolint` without the linter name and a reason; no `//tops:ack` without a reason and an owner. +6. Agent-authored code meets the same gate and the same CRAP cap as human code. +7. Do not edit generated files; fix the generator. +8. Prefer deleting code to adding configuration. +9. Never edit `.go-tops/baseline.json` by hand, and never wrap old findings in `//nolint` or `//tops:ack` to zero a count. + +## Common Agent Mistakes to Attack (explicit targets) + +When generating or reviewing code, specifically check for and reject the following high-frequency failure modes. The check that enforces each rule is in brackets. **[review]** means no tool catches it; the reviewer must. + +### Error Handling + +- **Never** discard errors with `_`. **Bad:** `_, _ = f.Write(data)`, `x, _ := strconv.Atoi(s)`. **[errcheck `check-blank`, G-12]** +- Check the error from `Close`, `Flush` and `Sync` on anything you wrote to. Use a named return and a deferred check that keeps the first error. A deferred `Close` on a reader passed as `io.ReadCloser` (a response body) passes the errcheck `exclude-functions` list, which holds only `(io.ReadCloser).Close`. A read-only file from `os.Open` takes a `//nolint:errcheck` with a reason, which is counted (§6.7 `suppressions`); `_ = f.Close()` fails. A file you wrote to is checked by review. **[errcheck, G-12; review]** +- Always wrap returned errors with operational context: `fmt.Errorf("action %s: %w", id, err)`. **[errorlint, G-11]** +- Use `errors.Is` / `errors.As`. Never match on `err.Error()` strings or direct equality on wrapped errors. **[errorlint, G-11]** +- Do not `panic` or call `Must*` helpers for recoverable conditions in library code. **[G-13]** + +### Concurrency & Context + +- Never spawn unbounded goroutines. Use `errgroup.WithContext` + `SetLimit` for concurrent work. **[review; G-01 heuristic]** +- Always accept `ctx context.Context` as the first parameter on I/O, DB, and network functions. **[revive `context-as-argument`, G-15, G-16]** +- Never introduce `context.Background()` or `context.TODO()` inside business logic (only allowed in `main`, wiring, and tests). **[G-17]** +- Never pass structs containing `sync.Mutex` or `sync.WaitGroup` by value. **[vet `copylocks`, G-07]** +- Prefer channels for orchestration/ownership transfer; prefer mutexes for protecting shared in-memory state. **[review]** +- No `time.Sleep` in tests to wait for concurrency. Use `testing/synctest` or channels; do not poll. On Go 1.27 or later, inside a `synctest` bubble use `synctest.Sleep(d)` (advances the fake clock, then waits until every other goroutine is durably blocked) and `httptest.NewTestServer(t, handler)` (an in-memory network). **[G-08]** + +### Idiomatic Design + +- Accept interfaces, return concrete structs. Define small (1–3 method) interfaces in the **consumer** package, not alongside implementations. **[review]** +- Avoid premature `any` / `interface{}` and reflection. Prefer typed structs or constrained generics. **[review]** +- Use the modern standard library: `os.ReadFile`, `slices`, `maps`, `errors`, `math/rand/v2`. Do not use deprecated `io/ioutil`. **[staticcheck deprecation checks]** + +### Resources & Performance + +- Always set timeouts on `http.Client` / `http.Server`. Never use `http.DefaultClient` in production code. **[G-19]** +- Bound untrusted reads (`io.LimitReader`, `http.MaxBytesReader`). Use `io.ReadAll` only on a bounded reader. **[G-20 heuristic]** +- Close response bodies, rows, files, and timers. Check `rows.Err()`. **[bodyclose, sqlclosecheck, rowserrcheck, G-18]** +- Preallocate slices when the length is known (`make([]T, 0, len(in))`). **[prealloc]** +- Prefer `strings.Builder` over `+=` in loops. **[review]** + +### Testing + +- Prefer table-driven tests with `t.Run`. **[review]** +- Call `t.Helper()` in test helpers so failures report the caller line. **[thelper]** +- Use `t.Cleanup` for teardown. **[review]** +- Tests must be deterministic: no wall-clock dependence, no unseeded randomness, no live network. **[G-31 heuristic]** + +## Verification (before finishing any task) + +```bash +go tool -modfile=tools/go.mod gotops gate +``` + +The gate runs hygiene first (tidy, verify, the toolchain pin, formatting, lint, vulnerabilities, licenses), then the test suite once, with the race detector, shuffling and coverage; coverage, CRAP and mutation read that run. The laws run last. Do not run them separately and call that done. Resolve all failures. A green gate is the definition of done. + +--- + +*Generated by `gotops init`. Update via the protocol change process if laws or floors change.* + + diff --git a/GO-TOPS.md b/GO-TOPS.md new file mode 100644 index 0000000..5b0bcf4 --- /dev/null +++ b/GO-TOPS.md @@ -0,0 +1,13 @@ +# Go-TOPS adoption record + +This repository adopts [Go-TOPS](https://github.com/Hedronite/go-tops). `go-tops.yaml` is the +authority: a line here that disagrees with it is wrong. + +1. **Adoption.** Go-TOPS, the Go testing and quality protocol. +2. **Protocol version.** 0.4.4. +3. **`gotops` and pinned tools.** `gotops` v0.0.0-20261119162302-608716388245 (pinned in tools/go.mod). Pins: toolchain go1.27.4 and golangci-lint 2.15.0 (go-tops.lock); go-licenses v2.0.1, gotestsum v1.13.0, govulncheck v1.9.0 (tools/go.mod). +4. **Class and thresholds.** `binary-service`: statement coverage floor 75%, CRAP cap 10, `enforce: ratchet`. +5. **Run the gate locally.** `just gate`, or `go tool -modfile=tools/go.mod gotops gate`. The kit's lint pass reads `.go-tops/golangci.yml`, not this repository's own `.golangci.yml`. The gate finds `golangci-lint` in `.go-tops/bin/` or on `PATH`: a repository whose tests walk the module tree keeps the binary outside it, on `PATH`, because a walk reads the files of `.go-tops/bin/` too. Install the pinned release into a directory outside the checkout, as the workflow's install step does. +6. **Baseline and ledgers.** The baseline is `.go-tops/baseline.json`; only `gotops baseline` writes it, never by hand. It records the build it was measured under, and the run with that build is the ledger leg: this repository's is the `ubuntu` leg of `.github/workflows/go-tops.yml`, and CI fails when that leg reports a ratchet outcome of `skip`. The baseline commands run only on the ledger leg's build. A repository with no ledger gets its first one on the pull request that adds this workflow: the `ubuntu` leg runs `gotops baseline --status`, and when no ledger exists on the base or in the tree it writes one with `gotops baseline --init`, uploads it as the `go-tops-baseline` artifact and fails the run until that file is committed unchanged. Once the workflow is on the default branch, run it by hand (`workflow_dispatch`) and pick `init` to write the first ledger with `gotops baseline --init`, or `refresh` to lower entries with `gotops baseline`; the ubuntu leg runs it and uploads the file as the `go-tops-baseline` artifact, which you commit. A refresh only lowers entries. Raising or adding an entry is manual, with `gotops baseline --accept-regression --reason --owner `: run it locally on the ledger leg's build, which on another platform is a `linux/amd64` Docker container of `golang:1.27.4` with the repository mounted at `/repo`, `GOTOOLCHAIN=local`, and the pinned golangci-lint 2.15.0 on `PATH` (the workflow's install step shows the archive and its SHA-256). Inside the container run `git config --global --add safe.directory /repo` first, because a checkout mounted on Linux can fail git's dubious-ownership check. The run needs network: the hygiene layer reads the vulnerability database. The mutation survivor ledger is `.go-tops/survivors.yaml`; the acknowledgement ledger is `.go-tops/acks.yaml`. +7. **Exemptions in force.** None. +8. **Known deviations.** The mutation gate is off until 2027-03-01, because the kit builds it in a later milestone; it carries its reason and expiry in `go-tops.yaml`. diff --git a/go-tops.lock b/go-tops.lock new file mode 100644 index 0000000..7e9864e --- /dev/null +++ b/go-tops.lock @@ -0,0 +1,24 @@ +# Pins for the Go toolchain and the downloaded binaries (GO_TOPS.md §10). +# Written by gotops init from the kit's pins; change it with a reviewed gotops lock --update. +protocol: "0.4.4" +toolchain: go1.27.4 + +trust: + mode: checksum + note: archive SHA-256 values copied from the upstream release checksum file; executable SHA-256 values computed from those verified archives + +binaries: + - name: golangci-lint + version: "2.15.0" + url: https://github.com/golangci/golangci-lint/releases/download/v{version}/golangci-lint-{version}-{os}-{arch}.tar.gz + extract: golangci-lint-{version}-{os}-{arch}/golangci-lint + sha256: + darwin/arm64: d1e409481a8ca846c4bc97e781eb5cb1bd5c23353a0b3977a1cbda1b1b6447d5 + darwin/amd64: 767b899a28285e88ded2823d5dcc4bc5ef681173eb2d80f029a7b17ee4ece3b8 + linux/amd64: 9b7fe6a6bf6334b98decf8d86b11415ea7889afdabdd1959fdce23af2a9ebcea + linux/arm64: b4d8f17068b35ee6060cc2f69a16fb48740d706fbba81661c318649c114a6998 + executable_sha256: + darwin/arm64: 71b89744ef6dd92dad9026b70489d1ad660da79ef90dfb5aabe995d916bec8a9 + darwin/amd64: e04962742507a5f37a4002a7a8b2b549f6864f17807eb5d534d947f6311a051f + linux/amd64: d9af4564c05beb2f5e130119aec45e5e89d28e5017d558d3ca382659f2427894 + linux/arm64: 14680d7674eb1fed0405446670e15dcffb74e979ef0dcd41f998c088fd6babfb diff --git a/go-tops.yaml b/go-tops.yaml new file mode 100644 index 0000000..6059ea2 --- /dev/null +++ b/go-tops.yaml @@ -0,0 +1,46 @@ +# Go-TOPS configuration (GO_TOPS.md §9), written by gotops init. +protocol: "0.4.4" +version: "0.1.0" +module: github.com/Hedronite/vigil +class: binary-service +enforce: ratchet # hard | ratchet | advisory (§6.7) +baseline: .go-tops/baseline.json + +toolchain: + go_floor: "1.27.0" + go_current: "1.27.4" + cgo: false + +gates: + hygiene: + golangci_lint: { config: .go-tops/golangci.yml } + govulncheck: { fail_on: reachable } + deps: { depguard: true, licenses: { allow: [MIT, Apache-2.0, BSD-3-Clause, BSD-2-Clause, ISC] } } + tests: + race: true + shuffle: true + count: 1 + coverage: + statements_floor: 75 + exclude_generated: true + crap: + enabled: true + cap: 10 + complexity: { err_guard_discount: true, wrap_functions: [] } + mutation: + enabled: false + reason: "mutation lands at M4 of the kit" + expires: "2027-03-01" + unexplained_survivors_max: 0 + ledger: .go-tops/survivors.yaml + +layers: + fuzz: { enabled: false, reason: "tier 2 layers land at M6", targets: [] } + stress: { enabled: false, reason: "tier 2 layers land at M6" } + bench: { enabled: false, reason: "tier 2 layers land at M6", regression_pct: 5 } + +laws: + ack_ledger: .go-tops/acks.yaml + +report: + path: .go-tops/report.json diff --git a/justfile b/justfile new file mode 100644 index 0000000..23dd85b --- /dev/null +++ b/justfile @@ -0,0 +1,18 @@ +# Front-door recipes for Go-TOPS (GO_TOPS.md §4.1). +gotops := "go tool -modfile=tools/go.mod gotops" + +# Validate go-tops.yaml and go-tops.lock. +check: + {{gotops}} check + +# The merge gate: every enabled layer at tier 1 and below. +gate: + {{gotops}} gate + +# Print the last report. +report: + {{gotops}} report --format text + +# Re-check every tool pin. +lock-verify: + {{gotops}} lock --verify diff --git a/tools/go.mod b/tools/go.mod new file mode 100644 index 0000000..fd91ab2 --- /dev/null +++ b/tools/go.mod @@ -0,0 +1,47 @@ +module github.com/Hedronite/vigil/tools + +go 1.27.4 + +tool github.com/Hedronite/go-tops/cmd/gotops + +require ( + github.com/Hedronite/go-tops v0.0.0-20261119162302-608716388245 // indirect + github.com/bitfield/gotestdox v0.2.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dnephin/pflag v1.0.7 // indirect + github.com/fatih/color v1.18.0 // indirect + github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/go-logr/logr v1.2.0 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/google/go-licenses/v2 v2.0.1 // indirect + github.com/google/licenseclassifier/v2 v2.0.0 // indirect + github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/otiai10/copy v1.10.0 // indirect + github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 // indirect + github.com/sergi/go-diff v1.2.0 // indirect + github.com/spf13/cobra v1.7.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + go.opencensus.io v0.24.0 // indirect + go.yaml.in/yaml/v3 v3.0.6 // indirect + golang.org/x/mod v0.42.0 // indirect + golang.org/x/net v0.61.0 // indirect + golang.org/x/sync v0.24.0 // indirect + golang.org/x/sys v0.49.0 // indirect + golang.org/x/telemetry v0.0.0-20261010193011-f71dc92da45e // indirect + golang.org/x/term v0.47.0 // indirect + golang.org/x/text v0.43.0 // indirect + golang.org/x/tools v0.52.0 // indirect + golang.org/x/vuln v1.9.0 // indirect + gotest.tools/gotestsum v1.13.0 // indirect + k8s.io/klog/v2 v2.90.1 // indirect +) + +// Added by gotops init: the kit's tool pins (GO_TOPS.md §10). +tool ( + github.com/google/go-licenses/v2 + golang.org/x/vuln/cmd/govulncheck + gotest.tools/gotestsum +) diff --git a/tools/go.sum b/tools/go.sum new file mode 100644 index 0000000..ef28a85 --- /dev/null +++ b/tools/go.sum @@ -0,0 +1,192 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Hedronite/go-tops v0.0.0-20261119162302-608716388245 h1:9xcwnwk45ZvXumD1Oz0kqvptyEwdvMbGTEXjCjjZzN8= +github.com/Hedronite/go-tops v0.0.0-20261119162302-608716388245/go.mod h1:lFJGuUIOhopa/czzRNRqdFq7m/tRWpIjdGmQ5mdw864= +github.com/bitfield/gotestdox v0.2.2 h1:x6RcPAbBbErKLnapz1QeAlf3ospg8efBsedU93CDsnE= +github.com/bitfield/gotestdox v0.2.2/go.mod h1:D+gwtS0urjBrzguAkTM2wodsTQYFHdpx8eqRJ3N+9pY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +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= +github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= +github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dnephin/pflag v1.0.7 h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk= +github.com/dnephin/pflag v1.0.7/go.mod h1:uxE91IoWURlOiTUIA8Mq5ZZkAv3dPUfZNaT80Zm7OQE= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786 h1:rcv+Ippz6RAtvaGgKxc+8FQIpxHgsF+HBzPyYL2cyVU= +github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786/go.mod h1:apVn/GCasLZUVpAJ6oWAuyP7Ne7CEsQbTnc0plM3m+o= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/go-licenses/v2 v2.0.1 h1:ti+9bi5o7DKbeeg5eBb/uZTgsaPNoJaLCh93cRcXsW8= +github.com/google/go-licenses/v2 v2.0.1/go.mod h1:efibo0EDNGkau6AIMOViGW+rTNPudhxX9rCxtfw5zKE= +github.com/google/go-replayers/httpreplay v1.2.0 h1:VM1wEyyjaoU53BwrOnaf9VhAyQQEEioJvFYxYcLRKzk= +github.com/google/go-replayers/httpreplay v1.2.0/go.mod h1:WahEFFZZ7a1P4VM1qEeHy+tME4bwyqPcwWbNlUI1Mcg= +github.com/google/licenseclassifier/v2 v2.0.0 h1:1Y57HHILNf4m0ABuMVb6xk4vAJYEUO0gDxNpog0pyeA= +github.com/google/licenseclassifier/v2 v2.0.0/go.mod h1:cOjbdH0kyC9R22sdQbYsFkto4NGCAc+ZSwbeThazEtM= +github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/otiai10/copy v1.10.0 h1:znyI7l134wNg/wDktoVQPxPkgvhDfGCYUasey+h0rDQ= +github.com/otiai10/copy v1.10.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww= +github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= +github.com/otiai10/mint v1.5.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM= +go.yaml.in/yaml/v3 v3.0.6/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= +golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw= +golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= +golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/telemetry v0.0.0-20261010193011-f71dc92da45e h1:P6NGsugec4oASJ+yKMNgTndeo0h2CbixZLvQIe9h5R4= +golang.org/x/telemetry v0.0.0-20261010193011-f71dc92da45e/go.mod h1:GNu+nb+E5axfGmP+Uu3ZVQu5lE/Xk42MjZOHWUD94/o= +golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= +golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs= +golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs= +golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM= +golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8= +golang.org/x/vuln v1.9.0 h1:12VaqnI9kJfqwRoPptxoqsUhQtdfrSbdksT7X/KY/sc= +golang.org/x/vuln v1.9.0/go.mod h1:E/Frwm0xp49fTyBW+6CQHdkvobknbwUM49yEpMGUauw= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/gotestsum v1.13.0 h1:+Lh454O9mu9AMG1APV4o0y7oDYKyik/3kBOiCqiEpRo= +gotest.tools/gotestsum v1.13.0/go.mod h1:7f0NS5hFb0dWr4NtcsAsF0y1kzjEFfAil0HiBQJE03Q= +gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= +gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= +k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=