Skip to content
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

ngo should skip the _cgo_gotypes.go #4079

Closed
hawkingrei opened this issue Sep 2, 2024 · 1 comment · Fixed by #4081
Closed

ngo should skip the _cgo_gotypes.go #4079

hawkingrei opened this issue Sep 2, 2024 · 1 comment · Fixed by #4081
Assignees

Comments

@hawkingrei
Copy link
Contributor

What version of rules_go are you using?

use rules_go v0.50.0

What version of gazelle are you using?

What version of Bazel are you using?

v7.3.1

Does this issue reproduce with the latest releases of all the above?

build tidb with nogo

What operating system and processor architecture are you using?

Any other potentially useful information about your toolchain?

What did you do?

What did you expect to see?

succeed to build without nogo error message

What did you see instead?

nogo: errors found by nogo during build-time code analysis:

pkg/lightning/manual/allocator.go:1:1: 

diff bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/_cgo_gotypes.go.orig bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/_cgo_gotypes.go

--- bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/_cgo_gotypes.go.orig

+++ bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/_cgo_gotypes.go

@@ -16,13 +16,17 @@

 import _cgopackage "runtime/cgo"

 

 type _ _cgopackage.Incomplete

+

 var _ syscall.Errno

+

 func _Cgo_ptr(ptr unsafe.Pointer) unsafe.Pointer { return ptr }

 

 //go:linkname _Cgo_always_false runtime.cgoAlwaysFalse

 var _Cgo_always_false bool

+

 //go:linkname _Cgo_use runtime.cgoUse

-func _Cgo_use(interface{})

+func _Cgo_use(any)

+

 type _Ctype_size_t = _Ctype_ulong

 

 type _Ctype_ulong uint64

@@ -33,10 +37,10 @@

 func _cgo_runtime_cgocall(unsafe.Pointer, uintptr) int32

 

 //go:linkname _cgoCheckPointer runtime.cgoCheckPointer

-func _cgoCheckPointer(interface{}, interface{})

+func _cgoCheckPointer(any, any)

 

 //go:linkname _cgoCheckResult runtime.cgoCheckResult

-func _cgoCheckResult(interface{})

+func _cgoCheckResult(any)

 

 //go:cgo_import_static _cgo_9ab048b9b408_Cfunc_calloc

 //go:linkname __cgofn__cgo_9ab048b9b408_Cfunc_calloc _cgo_9ab048b9b408_Cfunc_calloc

@@ -52,6 +56,7 @@

 	}

 	return

 }

+

 //go:cgo_import_static _cgo_9ab048b9b408_Cfunc_free

 //go:linkname __cgofn__cgo_9ab048b9b408_Cfunc_free _cgo_9ab048b9b408_Cfunc_free

 var __cgofn__cgo_9ab048b9b408_Cfunc_free byte

 (gofmt)

pkg/lightning/manual/allocator.go:1:1: 

diff bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/_cgo_imports.go.orig bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/_cgo_imports.go

--- bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/_cgo_imports.go.orig

+++ bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/_cgo_imports.go

@@ -1,4 +1,5 @@

 package manual

+

 //go:cgo_import_dynamic __libc_start_main __libc_start_main#GLIBC_2.2.5 "libc.so.6"

 //go:cgo_import_dynamic __gmon_start__ __gmon_start__ ""

 //go:cgo_import_dynamic _ITM_deregisterTMCloneTable _ITM_deregisterTMCloneTable ""

 (gofmt)

pkg/lightning/manual/allocator.go:1:1: 

diff bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/manual.cgo1.go.orig bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/manual.cgo1.go

--- bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/manual.cgo1.go.orig

+++ bazel-out/k8-fastbuild/bin/pkg/lightning/manual/manual_/manual.a.cgo/manual.cgo1.go

@@ -45,7 +45,7 @@

 	//   passing uninitialized C memory to Go code if the Go code is going to

 	//   store pointer values in it. Zero out the memory in C before passing it

 	//   to Go.

-	ptr := ( /*line :45:9*/_Cfunc_calloc /*line :45:16*/)( /*line :45:18*/_Ctype_size_t /*line :45:26*/(n), 1)

+	ptr := ( /*line :45:9*/ _Cfunc_calloc /*line :45:16*/)( /*line :45:18*/ _Ctype_size_t /*line :45:26*/ (n), 1)

 	if ptr == nil {

 		// NB: throw is like panic, except it guarantees the process will be

 		// terminated. The call below is exactly what the Go runtime invokes when

@@ -63,6 +63,6 @@

 			b = b[:cap(b)]

 		}

 		ptr := unsafe.Pointer(&b[0])

-		func() { _cgo0 := /*line :63:10*/ptr; _cgoCheckPointer(_cgo0, nil); /*line :63:14*/_Cfunc_free(_cgo0); }()

+		func() { _cgo0 := /*line :63:10*/ ptr; _cgoCheckPointer(_cgo0, nil); /*line :63:14*/ _Cfunc_free(_cgo0) }()

 	}

 }

 (gofmt)

@hawkingrei
Copy link
Contributor Author

Finally, I have to skip some files in the nogo

image

@fmeum fmeum self-assigned this Sep 2, 2024
fmeum added a commit that referenced this issue Sep 4, 2024
**What type of PR is this?**

Bug fix

**What does this PR do? Why is it needed?**

**Which issues(s) does this PR fix?**

Fixes #4079 

**Other notes for review**
tyler-french pushed a commit that referenced this issue Sep 4, 2024
**What type of PR is this?**

Bug fix

**What does this PR do? Why is it needed?**

**Which issues(s) does this PR fix?**

Fixes #4079

**Other notes for review**
tyler-french pushed a commit that referenced this issue Sep 5, 2024
**What type of PR is this?**

Bug fix

**What does this PR do? Why is it needed?**

**Which issues(s) does this PR fix?**

Fixes #4079

**Other notes for review**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants