Files
Kite fc5dc97841 build: keep node_modules out of the Go package list via a module boundary (#1125)
`go list ./...` walks into pages/node_modules/flatted/golang/pkg/flatted, a
third-party Go package npm installs as a transitive dependency of the docs
site. It is measured like our own code, and its 0% coverage pulls the reported
total down by ~1.4 points, so `make coverage` fails on a clean tree as soon as
the docs dependencies are installed:

    before: total 89.9%  ->  FAIL: Coverage 89.9% is below 90% threshold
    after:  total 91.3%  ->  PASS: Coverage 91.3% meets 90% threshold

Rather than filter the package out per command, this puts pages/ in a module of
its own. `go list ./...` skips any subtree that carries its own go.mod, so every
tool that expands ./... is fixed at once: go test, go vet, go build,
govulncheck, and the coverage gate. A `grep -v /node_modules/` would instead
have to be repeated at each of the seven call sites that expand ./... today --
one in the Makefile, six in ci.yml -- and would silently fail to cover the ones
added later. As a result neither the Makefile's PACKAGES nor ci.yml needs to
change, including the CI coverage step, which calls `go test ./...` directly and
has the identical exposure whenever pages/node_modules is present in the
workspace -- a real possibility on the self-hosted runners, which reuse their
checkout directories.

pages/ holds no Go code of ours, so the boundary costs nothing today. The
Makefile does gain a comment pointing at it: PACKAGES otherwise shows no trace
of the invariant, and deleting pages/go.mod would quietly put the package back
in the list. The same comment records why the /extensions/ filter stays --
extensions/vscode has no Go code of ours either, but its eslint dependency
installs a second copy of flatted's.
2026-09-01 17:53:04 +08:00

17 lines
844 B
AMPL

// This module exists only to keep the docs site out of the root module's
// package tree. Without it, `go list ./...` walks into
// pages/node_modules/flatted/golang -- a third-party Go package that npm
// installs as a transitive dependency of the docs site -- and every tool that
// expands ./... picks it up: go test, go vet, go build, govulncheck, and the
// coverage gate, whose total it drags below the threshold with its 0%.
//
// A module boundary fixes this once for all of them, which per-command
// `grep -v /node_modules/` filters cannot: those have to be repeated at every
// call site and silently stop covering the ones added later.
//
// There is no Go code of ours under pages/. If that ever changes, this file
// becomes a real module and should be treated as one.
module github.com/alibaba/open-code-review/pages
go 1.25.5