Break import cycle between libs/env and internal/testutil#4708
Merged
Conversation
Move libs/env tests to external test package (env_test) so that internal/testutil can import libs/env directly. This removes the nolint:forbidigo exceptions in internal/testutil. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
Commit: 589dc55
16 interesting tests: 7 SKIP, 6 RECOVERED, 3 flaky
Top 21 slowest tests (at least 2 minutes):
|
simonfaltum
approved these changes
Mar 12, 2026
rauchy
pushed a commit
that referenced
this pull request
Mar 17, 2026
## Summary - Move `libs/env` tests from `package env` to `package env_test` to break the import cycle - This allows `internal/testutil` to import `libs/env` directly - Replace `os.Getenv`/`os.UserHomeDir` calls in `internal/testutil` with `env.Get(ctx)`/`env.UserHomeDir(ctx)`, removing all `nolint:forbidigo` exceptions Follow-up to #4700 and #4654 which added the forbidigo linter rules but had to add `nolint` exceptions in `internal/testutil` due to the import cycle. ## Test plan - [x] `go test ./libs/env/...` passes - [x] `go test ./internal/testutil/...` passes - [x] `make lintfull` passes (no more nolint exceptions for the cycle) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
libs/envtests frompackage envtopackage env_testto break the import cycleinternal/testutilto importlibs/envdirectlyos.Getenv/os.UserHomeDircalls ininternal/testutilwithenv.Get(ctx)/env.UserHomeDir(ctx), removing allnolint:forbidigoexceptionsFollow-up to #4700 and #4654 which added the forbidigo linter rules but had to add
nolintexceptions ininternal/testutildue to the import cycle.Test plan
go test ./libs/env/...passesgo test ./internal/testutil/...passesmake lintfullpasses (no more nolint exceptions for the cycle)🤖 Generated with Claude Code