Skip to content

Instantly share code, notes, and snippets.

@nebril
Created July 18, 2019 22:38
Show Gist options
  • Save nebril/d4515e372b47fa00a8ee9d2faf4bbacd to your computer and use it in GitHub Desktop.
Save nebril/d4515e372b47fa00a8ee9d2faf4bbacd to your computer and use it in GitHub Desktop.
Golang print struct funcs
package main
import (
"fmt"
"reflect"
"strings"
"github.com/cilium/cilium/test/helpers"
)
func main() {
k := &helpers.Kubectl{}
kType := reflect.TypeOf(k)
for i := 0; i < kType.NumMethod(); i++ {
method := kType.Method(i)
fmt.Printf("%s%s\n", method.Name, strings.TrimPrefix(method.Type.String(), "func"))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment