Skip to content

Conversation

k1LoW
Copy link
Owner

@k1LoW k1LoW commented Aug 14, 2025

This pull request improves the environment file loading logic in env/env.go to handle cases where a specified profile does not exist, and updates the corresponding test in env/env_test.go to check for this error scenario.

Environment file loading enhancements:

  • Added a check in Env.LoadEnvFiles to return an error if a profile is specified but the environment file is not found in any search directory.
  • Changed the directory traversal to use slices.Reverse for loading files from lower priority directories first, simplifying the code. [1] [2]

Test updates:

  • Modified the test case in env/env_test.go to expect an error when a profile is specified but no corresponding environment file exists.

@k1LoW k1LoW self-assigned this Aug 14, 2025
@k1LoW k1LoW added enhancement New feature or request minor labels Aug 14, 2025
Copy link
Contributor

Code Metrics Report

main (2379268) #8 (1978532) +/-
Coverage 56.5% 61.6% +5.0%
Code to Test Ratio 1:2.2 1:2.0 -0.2
Test Execution Time 1s 2s +1s
Details
  |                     | main (2379268) | #8 (1978532) |  +/-  |
  |---------------------|----------------|--------------|-------|
+ | Coverage            |          56.5% |        61.6% | +5.0% |
  |   Files             |              3 |            3 |     0 |
  |   Lines             |             76 |           86 |   +10 |
+ |   Covered           |             43 |           53 |   +10 |
- | Code to Test Ratio  |          1:2.2 |        1:2.0 |  -0.2 |
  |   Code              |            162 |          177 |   +15 |
  |   Test              |            361 |          361 |     0 |
- | Test Execution Time |             1s |           2s |   +1s |

Code coverage of files in pull request scope (87.7% → 89.8%)

Files Coverage +/- Status
env/env.go 89.8% +2.0% modified

Reported by octocov

@k1LoW k1LoW merged commit 8e62bb2 into main Aug 14, 2025
1 check passed
@k1LoW k1LoW deleted the fix-profiled-base-env-handling branch August 14, 2025 03:19
@github-actions github-actions bot mentioned this pull request Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant