-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
通过gccgo编译出的go程序不能正确的获取go版本 #335
Labels
🐞 bug
Something isn't working
Comments
应该存在这个问题,之前没考虑到这个场景,空了我测下,感谢反馈。 |
我测试了一下,好像没问题,可以正常工作,你看下PR #342 |
我又确认了一下,golang官方也是这么写的。 bi, err := buildinfo.ReadFile(file)
if err != nil {
if mustPrint {
if pathErr := (*os.PathError)(nil); errors.As(err, &pathErr) && filepath.Clean(pathErr.Path) == filepath.Clean(file) {
fmt.Fprintf(os.Stderr, "%v\n", file)
} else {
// Skip errors for non-Go binaries.
// buildinfo.ReadFile errors are not fine-grained enough
// to know if the file is a Go binary or not,
// so try to infer it from the file mode and extension.
if isGoBinaryCandidate(file, info) {
fmt.Fprintf(os.Stderr, "%s: %v\n", file, err)
}
}
}
return
}
fmt.Printf("%s: %s\n", file, bi.GoVersion)
bi.GoVersion = "" // suppress printing go version again
mod := bi.String()
if *versionM && len(mod) > 0 {
fmt.Printf("\t%s\n", strings.ReplaceAll(mod[:len(mod)-1], "\n", "\n\t"))
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
目前在pkg/proc/proc.go中是使用"debug/buildinfo"的ReadFile方法获取go版本信息,但是程序是用gccgo编译出来的,不能读取到任何信息
The text was updated successfully, but these errors were encountered: