From 91deb1e224d0a6275b4aaf54ef65043e5cae1e15 Mon Sep 17 00:00:00 2001 From: lu4p Date: Sat, 23 Jan 2021 02:15:50 +0100 Subject: [PATCH] Document reflect.TypeOf hint (#211) * Document reflect.TypeOf hint Fixes #163 * Fix nit --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index d65c117..7e8cbce 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,18 @@ to document the current shortcomings of this tool. * Go plugins are not currently supported; see [#87](https://github.com/burrowers/garble/issues/87). +* There are cases where garble is a little too agressive with obfuscation, this may lead to identifiers getting obfuscated which are needed for reflection, e.g. to parse JSON into a struct; see [#162](https://github.com/burrowers/garble/issues/162). To work around this you can pass a hint to garble, that an type is used for reflection via passing it to `reflect.TypeOf` or `reflect.ValueOf` in the same file: + ```go + // this is used for parsing json + type Message struct { + Command string + Args string + } + + // never obfuscate the Message type + var _ = reflect.TypeOf(Message{}) + ``` + ### Tiny Mode When the `-tiny` flag is passed, extra information is stripped from the resulting