@@ -116,6 +116,15 @@ linters:
116116 - pattern : ^os\.(UserHomeDir|UserCacheDir|UserConfigDir)$
117117 pkg : ^os$
118118 msg : use the venv's Platform handles instead of reading the invoking user's directories
119+ - pattern : ^os\.(Getpid|Executable|Hostname)$
120+ pkg : ^os$
121+ msg : use the venv's Platform handles instead of reading the running process
122+ - pattern : ^os\.Args$
123+ pkg : ^os$
124+ msg : take the arguments the CLI was handed rather than reading the process arguments
125+ - pattern : ^runtime\.(GOOS|GOARCH)$
126+ pkg : ^runtime$
127+ msg : take the platform from the venv's Platform.GOOS and Platform.GOARCH instead of the compiled-in constants
119128 - pattern : ^os\.(Stdin|Stdout|Stderr)$
120129 pkg : ^os$
121130 msg : read and write the venv's Reader and Writers, and ask its Terminal whether a stream is a tty
@@ -128,11 +137,6 @@ linters:
128137 - pattern : ^http\.Default(Client|Transport)$
129138 pkg : ^net/http$
130139 msg : send through the venv's vhttp.Client instead of the shared default client
131- # A composite literal builds a client without calling anything the rules
132- # above match, so it is the remaining way to reach the network past the
133- # venv. The two production sites that survive it are the GCS client
134- # constructors, whose nolint directives cover this rule as well; both
135- # wrap a transport derived from the venv's own client.
136140 - pattern : ^http\.Client$
137141 pkg : ^net/http$
138142 msg : take the client from the venv's vhttp.Client rather than building one
@@ -147,9 +151,6 @@ linters:
147151 msg : resolve links on the venv's vfs.FS via vfs.EvalSymlinks, or vfs.ResolveForCompare when the result is to be compared against another path
148152 - pattern : ^(vfs\.NewOSFS|vexec\.NewOSExec|vhttp\.NewOSClient|vsops\.NewOSDecrypter)$
149153 msg : take the handle from the venv already in scope rather than building a fresh OS-backed one
150- # Cloud SDKs build their own transport when handed no client, so these
151- # entry points leak past the venv without any net/http call of our own
152- # for the rules above to catch.
153154 - pattern : ^config\.LoadDefaultConfig$
154155 pkg : ^github.com/aws/aws-sdk-go-v2/config$
155156 msg : build AWS config via awshelper.NewAWSConfigBuilder so requests ride the venv's HTTP client
@@ -221,33 +222,41 @@ linters:
221222 - linters :
222223 - forbidigo
223224 path : ^(internal/view/tui/tty\.go|internal/tf/run_cmd\.go)$
224-
225- # Everything below are the call sites that predate the forbidigo
226- # rules above. They reach the real OS directly and still need porting to
227- # venv. Delete entries as they are ported.
228-
229- - linters :
230- - forbidigo
231- path : ^(internal/cli/commands/browse/tui/model\.go|internal/cli/commands/catalog/cli\.go|internal/view/tui/form/form\.go|internal/cli/commands/catalog/tui/tags_layout\.go|internal/cli/commands/commands\.go|internal/cli/commands/hcl/validate/validate\.go|internal/cli/commands/help/cli\.go|internal/cli/commands/render/render\.go|internal/cli/commands/scaffold/cli\.go|internal/cli/commands/scaffold/scaffold\.go)$
232- - linters :
233- - forbidigo
234- path : ^(internal/tf/cache/handlers/filesystem_mirror_provider\.go|internal/tf/cache/helpers/http\.go|internal/tf/cliconfig/credentials\.go|internal/tf/getproviders/constraints\.go|internal/tf/getproviders/hash\.go|internal/tf/getproviders/lock\.go|internal/tf/getproviders/package_authentication\.go|internal/tf/source\.go|internal/tf/tf\.go)$
225+ # main is where the process arguments enter the program and become the
226+ # arguments every layer below is handed, so it is the one place that has
227+ # nothing to read them from.
235228 - linters :
236229 - forbidigo
237- path : ^(internal/runner/common/unit_runner\.go|internal/runner/run/debug\.go|internal/runner/run/run\.go|internal/runner/runnerpool/runner\.go)$
238- - linters :
239- - forbidigo
240- path : ^(pkg/config/catalog\.go|pkg/config/config_helpers\.go|pkg/config/config_partial\.go|pkg/config/config\.go|pkg/config/dependency\.go|pkg/config/stack\.go)$
241- # DefaultWrappedPath is a package-level var, so it probes for `tofu` at
242- # init time, before any venv exists.
243- #
244- # TODO: Make the lookup lazy with a once so we can inject venv into this.
230+ text : use of `os.Args`
231+ path : ^main\.go$
232+
233+ # The vendored urfave/cli help renderer reads CLI_TEMPLATE_ERROR_DEBUG
234+ # from the process with os.Getenv, so the only way to turn its template
235+ # diagnostics on is to put the variable where it will look.
245236 - linters :
246237 - forbidigo
247- path : ^pkg/options/options\.go$
238+ text : use of `os.Setenv`
239+ path : ^internal/cli/commands/help/cli\.go$
240+
241+ # Style debt in two paths the exclusion patterns at the bottom of this
242+ # file had swallowed: unanchored, "docs" and ".github" also matched
243+ # test/integration_docs_test.go and internal/github/. The venv rules are
244+ # deliberately absent from this list, so they apply to both paths; only
245+ # the unrelated findings are held back, to be cleaned up on their own.
248246 - linters :
249- - forbidigo
250- path : ^(internal/discovery/phase_worktree\.go|internal/engine/engine\.go|internal/engine/verification\.go|internal/getter/tfrhelpers\.go|internal/git/git\.go|internal/remotestate/remote_state\.go|internal/remotestate/terraform_state_file\.go|internal/report/writer\.go|internal/services/catalog/module/doc\.go|internal/services/catalog/module/module\.go|internal/shell/run_cmd\.go|internal/stacks/clean/clean\.go|internal/tfimpl/tfimpl\.go|internal/util/lockfile\.go|internal/worktrees/worktrees\.go)$
247+ - errcheck
248+ - govet
249+ - mnd
250+ - paralleltest
251+ - perfsprint
252+ - staticcheck
253+ - testifylint
254+ - thelper
255+ - tparallel
256+ - unused
257+ - wsl_v5
258+ path : ^(internal/github/|test/integration_docs_test\.go$)
259+
251260 # We end up with duplicated content in this package to save us from duplicating code in other packages.
252261 - linters :
253262 - dupl
@@ -266,10 +275,10 @@ linters:
266275 - lll
267276 path-except : " ^(internal/awshelper/|internal/cas/|internal/cli/commands/(backend/(delete|migrate)|browse|catalog/tui/command|dag/graph|exec|find|help|list|scaffold|stack)/|internal/cloner/|internal/codegen/|internal/configbridge/|internal/discovery/|internal/engine/|internal/errorconfig/|internal/errors/|internal/experiment/|internal/filter/|internal/gcphelper/|internal/getter/|internal/git/|internal/os/exec/|internal/prepare/|internal/queue/|internal/report/|internal/retry/|internal/runner/(common|graph|run/creds|runall|runcfg)/|internal/stacks/(generate|output)/|internal/telemetry/|internal/tf/cache/(controllers|middleware)/|internal/tflint/|internal/tips/|internal/vfs/|internal/worktrees/|pkg/log/(format/(options|placeholders)|writer)/|pkg/options/)"
268277 paths :
269- - docs
270- - _ci
271- - .github
272- - .circleci
278+ - ^ docs/
279+ - ^ _ci/
280+ - ^\ .github/
281+ - ^\ .circleci/
273282 - third_party$
274283 - builtin$
275284 - examples$
@@ -285,10 +294,10 @@ formatters:
285294 exclusions :
286295 generated : lax
287296 paths :
288- - docs
289- - _ci
290- - .github
291- - .circleci
297+ - ^ docs/
298+ - ^ _ci/
299+ - ^\ .github/
300+ - ^\ .circleci/
292301 - third_party$
293302 - builtin$
294303 - examples$
0 commit comments