Created
July 18, 2019 22:38
-
-
Save nebril/d4515e372b47fa00a8ee9d2faf4bbacd to your computer and use it in GitHub Desktop.
Golang print struct funcs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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