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
If a renaming edits a file that imports "C", that file gets completely overwritten by the result of cgo preprocessing (and renaming) applied to that file, potentially destroying source code:
$ cat test.go
package test
/* #include <stdio.h> */
import "C"
func f() { C.puts(nil) }
$ cat test2.go
package test
func _() { f() }
$ gorename -from test::f -to g
Renamed 2 occurrences in 2 files in 1 package.
$ cat test.go
// Created by cgo - DO NOT EDIT
//line /usr/local/google/home/adonovan/go/src/test/test.go:1
package test
//line /usr/local/google/home/adonovan/go/src/test/test.go:7
//line /usr/local/google/home/adonovan/go/src/test/test.go:6
func g() { _Cfunc_puts(nil) }
$ cat test2.go
package test
func _() { g() }
The text was updated successfully, but these errors were encountered:
package main
/*
#include <stdio.h>
void put(int* x) {
printf("%p\n", x);
}
*/
import "C"
var p *C.int
func main() {
C.put(p)
}
quentinmit
changed the title
cmd/gorename: renaming clobbers files that import "C"
x/tools/cmd/gorename: renaming clobbers files that import "C"
Nov 8, 2016
If a renaming edits a file that imports "C", that file gets completely overwritten by the result of cgo preprocessing (and renaming) applied to that file, potentially destroying source code:
The text was updated successfully, but these errors were encountered: