4 ms·
How did vendored code that didn't change break your build?
by Scaevolus 6y ago
How did vendored code that didn't change break your build?
- zaarn 6y agoI updated the compiler.
- TheDong 6y agoThe easiest way to accomplish that is definitely with //go:linkname You can use a comment of the format '//go:linkname [localname] [method]' to link some function as another one. Notably, this includes unexported private methods in the go runtime and stdlib. I've seen code in the wild that uses this to grab go's map hash algorithm, get monotonic time, and other things. The go authors have used this hack themselves in the stdlib often enough because the runtime doesn't expose some knob, and rather than thinking that perhaps other developers may want that knob too, they instead use such hacks, but they also don't support said hacks (because how could you, obviously keeping all private functions stable forever is silly and impossible)