Skip to content

Instantly share code, notes, and snippets.

@mem
Created September 27, 2023 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mem/83f6c9bb82cf7ea2eeea5668d596068f to your computer and use it in GitHub Desktop.
Save mem/83f6c9bb82cf7ea2eeea5668d596068f to your computer and use it in GitHub Desktop.
how to use go:linkname
package main
import (
"fmt"
_ "unsafe"
_ "github.com/prometheus/prometheus/model/textparse"
dto "github.com/prometheus/prometheus/prompb/io/prometheus/client"
)
//go:linkname isNativeHistogram github.com/prometheus/prometheus/model/textparse.isNativeHistogram
func isNativeHistogram(h *dto.Histogram) bool
func main() {
v := isNativeHistogram(nil)
fmt.Println(v)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment