go-patch-overlay icon indicating copy to clipboard operation
go-patch-overlay copied to clipboard

Compile failed.

Open tutumagi opened this issue 4 years ago • 4 comments

In ./example/goroutineid foler. Execute go1.16 build -overlay="$(../../go-patch-overlay ./patches)"

go1.16 build -overlay="$(../../go-patch-overlay ./patches)"
# github.com/felixge/go-patch-overlay/example/goroutineid
./main.go:17:21: undefined: runtime.Getgid
./main.go:20:22: undefined: runtime.Getgid
./main.go:24:22: undefined: runtime.Getgid
./main.go:28:22: undefined: runtime.Getgid

How should I fix it?

tutumagi avatar May 14 '21 02:05 tutumagi

@tutumagi hm, I can't reproduce this issue locally. Can you run this and share the output you get?

cat "$(../../go-patch-overlay ./patches)"

felixge avatar May 14 '21 08:05 felixge

$ ../../go-patch-overlay ./patches          
/var/folders/sl/jm36v99n2yj1w02tlvmnzdc80000gn/T/go-patch-overlay007724818/overlay.json

tutumagi avatar May 14 '21 09:05 tutumagi

$ ../../go-patch-overlay ./patches          
/var/folders/sl/jm36v99n2yj1w02tlvmnzdc80000gn/T/go-patch-overlay007724818/overlay.json

the json file' content is:

{
  "Replace": {
    "/usr/local/go/src/runtime/stubs.go": "/var/folders/sl/jm36v99n2yj1w02tlvmnzdc80000gn/T/go-patch-overlay007724818/src/runtime/stubs.go"
  }
}

tutumagi avatar May 14 '21 09:05 tutumagi

What does go1.16 env GOROOT give you? Did you compile ../../go-patch-overlay with the same go1.16 binary? If not, that's probably the cause of this issue.

felixge avatar May 14 '21 09:05 felixge