Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds tests to verify the correct behavior of GORM's FileWithLineNum utility function and slog logger caller source reporting. The PR replaces the generic GORM functionality test with two focused tests that validate file/line number reporting works correctly when called from external functions and that the slog logger properly attributes log entries to the calling code rather than internal logger code.
Changes:
- Added two new tests:
TestFileWithLineNumExternalandTestSlogCallerSourceto verify file/line number reporting - Updated go.mod with dependency version bumps (GORM v1.30.1 → v1.31.1, various driver updates) and added testify for assertions
- Removed unused dependencies from go.mod
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| main_test.go | Replaced generic GORM test with focused tests for FileWithLineNum functionality and slog caller source reporting |
| go.mod | Updated dependencies including GORM core library, added testify, and cleaned up unused dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expectedSuffix := fmt.Sprintf("%s:%d", filepath.ToSlash(file), expectedLine) | ||
| require.Equal(t, expectedSuffix, got) |
There was a problem hiding this comment.
The variable is named 'expectedSuffix' but is used in an exact equality check on line 31. If the intent is to check for an exact match, consider renaming to 'expected' or 'expectedPath' for clarity. If the intent is to verify a suffix match, the assertion should use a suffix check instead of exact equality.
| expectedSuffix := fmt.Sprintf("%s:%d", filepath.ToSlash(file), expectedLine) | |
| require.Equal(t, expectedSuffix, got) | |
| expectedPath := fmt.Sprintf("%s:%d", filepath.ToSlash(file), expectedLine) | |
| require.Equal(t, expectedPath, got) |
Explain your user case and expected results
I am creating a issue in GORM for further explain