-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix bug in windows #5844
fix bug in windows #5844
Conversation
Hi @kvii Thank you for the fix, but please don't add the build tag for the windows tests, or we can't cover those cases with GitHub actions. Thank you. |
I made a mistake that I thought the "_unix" suffix was also supported by go. So I got some "TestFn redeclared in this block" error in windows. That's the reason I was use build constraint (build tag). Related go issue: golang/go#51572 |
@jinzhu I removed build tags in windows tests. |
@jinzhu 您方便继续跟进一下这个 windows bug 吗? "//go:build unix" 确实不能删除。因为如果删除它的话,"utils_unix_test.go" 在 windows 系统下也会被编译。这会导致 window 用户的编译错误!虽然有 "// +build unix" 的文件在 windows 系统下确实不会被编译。但这并不意味着 "_unix.go" 也有同样的作用。具体原因可以参考我之前的评论。在这里再举一个 go 标准库的例子。可以看到 go 源码的 "src/path/filepath/example_unix_test.go" 也使用了 "//go:build"。 有可能您是让我只删除 "//go:build unix" 那一行。因为项目 go.mod 中的要求的 go 版本为 1.16,而 "//go:build unix" 格式的声明是 go 1.17 的新特性。可能因为您怕新格式和旧版本 go 不兼容。但这应该是您多虑了。因为这种新老版本混合的写法是兼容旧版本的。并且这是新版 go fmt 命令的默认行为。可以参考 中文博客 和 build constaints 设计草案。 最后很抱歉我使用了中文并且直接 @ 了您。因为我看到已经有 2 个关于这个问题的 issue,说明开发者已经开始陆陆续续地升级到 1.24.1 版本了。我希望这个问题能尽快地被解决。我也为我在 #5836 犯下的错误感到抱歉。 |
@dreamlu Seems like "github.com/casbin/gorm-adapter/v3" it not an official package. Gorm only filters source path contains "gorm.io".
Lines 36 to 41 in e57e5d8
|
in that picture, the right is printed by in that picture, the not right print is printed by
|
my system:linux |
@dreamlu What's your expect behavior? ![]() ![]() |
in goland, it should be click to origin code, but can't
I think the latest gorm , lost some symbol in linux print |
Is there anyone can solve the problem? |
You should create a new issue and provide a minimal reproduction project if you want to solve this "problem". |
What did this pull request do?
This pr is intent to fix the bug that I made in #5836.
"runtime.Caller" will return path like "C:/Users/name/go/pkg/mod/gorm.io/gorm@v1.2.3/utils/utils.go" in windows, not "C:\foo\bar".
And "TestSourceDir" redeclared in windows. Even I placed it to "utils_unix_test.go" and "utils_windows_test.go".
User Case Description
See https://github.com/kvii/gormt.git