You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In stacktrace.go, the logic relies on packageName := buildInfo.Path, assuming that buildInfo.Path represents the directory name of the oops package. However, buildInfo.Path contains the module path, not the package directory name. This discrepancy causes the following issues:
Stack trace filtering logic incorrectly includes or excludes frames.
Inconsistent behavior when the library is used in different environments (e.g., local applications, larger projects).
Here, buildInfo.Path does not correspond to the directory or package name of oops, leading to incorrect filtering of stack trace entries.
Impact:
The stack trace may include irrelevant frames or exclude crucial ones.
Debugging becomes unreliable when using the library.
Steps to Reproduce:
Create a Go project that uses the oops library.
Trigger an error in the local application context.
Inspect the generated stack trace.
Expected Behavior:
The stack trace should correctly include all relevant frames without excluding valid entries or including irrelevant ones.
Actual Behavior:
Stack trace filtering behaves unpredictably due to overly broad strings.Contains matching.
Valid stack trace entries are excluded or irrelevant entries are included.
Suggested Fix:
Refine the logic in stacktrace.go to ensure accurate identification of package-related stack trace frames. A possible solution:
Use exact string matching or a more robust path parsing method instead of strings.Contains.
Consider leveraging path/filepath to handle package and file path comparisons in a platform-independent way.
This ensures that the match is explicit and avoids unintended partial matches.
Environment:
Go version: go version go1.23.3 darwin/arm64
oops library version: v1.14.1
Operating system: macOS
Additional Notes:
This issue might affect other similar filtering logic within the library, so a thorough review is recommended. I can provide more detailed examples or a reproducible demo if needed.
The text was updated successfully, but these errors were encountered:
In stacktrace.go, the logic relies on packageName := buildInfo.Path, assuming that buildInfo.Path represents the directory name of the oops package. However, buildInfo.Path contains the module path, not the package directory name. This discrepancy causes the following issues:
Stack trace filtering logic incorrectly includes or excludes frames.
Inconsistent behavior when the library is used in different environments (e.g., local applications, larger projects).
Problem:
The relevant code in stacktrace.go:
Here, buildInfo.Path does not correspond to the directory or package name of oops, leading to incorrect filtering of stack trace entries.
Impact:
Steps to Reproduce:
Expected Behavior:
The stack trace should correctly include all relevant frames without excluding valid entries or including irrelevant ones.
Actual Behavior:
Stack trace filtering behaves unpredictably due to overly broad strings.Contains matching.
Valid stack trace entries are excluded or irrelevant entries are included.
Suggested Fix:
Refine the logic in stacktrace.go to ensure accurate identification of package-related stack trace frames. A possible solution:
Use exact string matching or a more robust path parsing method instead of strings.Contains.
Consider leveraging path/filepath to handle package and file path comparisons in a platform-independent way.
This ensures that the match is explicit and avoids unintended partial matches.
Environment:
Additional Notes:
This issue might affect other similar filtering logic within the library, so a thorough review is recommended. I can provide more detailed examples or a reproducible demo if needed.
The text was updated successfully, but these errors were encountered: