E-LINT-011: replace, go.work or vendor not allowed
An app is built only from the modules its go.mod requires, so the checks read the same code the build runs. aicoded check refuses these ways of building other code: a replace directive in go.mod, a go.work file the go command reads for the app, a vendor folder at the app root, a module cache that go mod verify does not pass, and a GOFLAGS with any entry outside a short list. A replace points the build at a folder on this computer or at another module, so a builder's own code or a changed copy of the framework would stand in for a module and go unchecked; a go.work file's use and replace lines do the same; and a vendor folder is built in place of the required modules and can hold a changed copy of any of them. Lint runs go mod verify and refuses every outcome but exit status 0 with the line all modules verified, such as a module whose files changed after it was downloaded or a file the go command cannot read; the finding quotes the first line of the go command's output, with the module cache folder written $GOMODCACHE, and go clean -modcache fixes it. go mod verify compares the cache only with the hashes the cache itself keeps, so a changed copy in the module cache, however it got there, with a matching .ziphash and go.sum line cannot be detected on this computer; that includes a copy served by a GOPROXY the builder chose. The delivery pipeline builds from a clean module cache. Before lint runs a go command of its own, and before aicoded check runs go env, go build or go vet for the app, lint reads GOFLAGS from the environment, and then the value that go env -json GOFLAGS prints, which go env -w or the Go installation's go.env can set; each is split at spaces, tabs and line breaks. A value that holds a quote, a backslash or another control character is refused, and so is every entry other than -mod=mod, -mod=readonly, -modcacherw, -trimpath, -buildvcs=true, -buildvcs=false, -buildvcs=auto, -v and -x, each written exactly so, with one dash; a go env that fails, or prints anything but one JSON object with GOFLAGS as a string, is refused too, with the first line of what the go command printed that is not a go: downloading notice. When the go command itself cannot run, such as when go.mod asks for a newer Go that GOTOOLCHAIN cannot download, fix what it reports, such as the go line of go.mod or GOTOOLCHAIN. So a GOFLAGS of -u or -w in the go env file, which would turn lint's go env into a command that changes that file, fails instead, and lint never changes the file. There is one exception to the replace rule: an aicoded installed with make install from a framework checkout accepts the replace of aicoded.dev/framework with that very checkout, which its aicoded init writes; the folders are compared as absolute paths with their symbolic links resolved. A released aicoded accepts no replace at all, and the delivery pipeline refuses every one (E-GATE-001). The replace finding is at its line in go.mod, the go.work finding at the file's first line, the vendor finding at vendor/modules.txt or the vendor folder, the module-cache finding at the first line of go.mod, and the GOFLAGS finding names the variable.
Fix: remove the replace line, the go.work file, the vendor folder or the GOFLAGS entries outside the list; run go clean -modcache when go mod verify fails; and require a released version of the module; when the go command itself cannot run, fix what it reports, such as the go line of go.mod or GOTOOLCHAIN.