Clone this repo:


  1. fb5bbe6 Better to trigger Travis. by Dan Jacques · 1 year, 3 months ago master
  2. f7e939d Fork of LUCI project's render package. by Dan Jacques · 1 year, 3 months ago

go-render: A verbose recursive Go type-to-string conversion library.

GoDoc Build Status

This is not an official Google product.


The render package implements a more verbose form of the standard Go string formatter, fmt.Sprintf("%#v", value), adding:

  • Pointer recursion. Normally, Go stops at the first pointer and prints its address. The render package will recurse and continue to render pointer values.
  • Recursion loop detection. Recursion is nice, but if a recursion path detects a loop, render will note this and move on.
  • Custom type name rendering.
  • Deterministic key sorting for string- and int-keyed maps.
  • Testing!

Call render.Render and pass it an interface{}.

For example:

type customType int
type testStruct struct {
        S string
        V *map[string]int
        I interface{}

a := testStruct{
        S: "hello",
        V: &map[string]int{"foo": 0, "bar": 1},
        I: customType(42),

fmt.Println("Render test:")
fmt.Printf("fmt.Printf:    %#v\n", a)))
fmt.Printf("render.Render: %s\n", Render(a))


fmt.Printf:    render.testStruct{S:"hello", V:(*map[string]int)(0x600dd065), I:42}
render.Render: render.testStruct{S:"hello", V:(*map[string]int){"bar":1, "foo":0}, I:render.customType(42)}

This is not intended to be a high-performance library, but it's not terrible either.


  • Sign the Google CLA.
  • Make sure your and are configured in git config.
  • Install the pcg git hook: go get -u && pcg

Run the following to setup the code review tool and create your first review:

git clone $HOME/src/depot_tools
export PATH="$PATH:$HOME/src/depot_tools"
git checkout -b work origin/master

# hack hack

git commit -a -m "This is awesome\"
# This will ask for your Google Account credentials.
git cl upload -s
# Wait for LGTM over email.
# Check the commit queue box in codereview website.
# Wait for the change to be tested and landed automatically.

Use git cl help and git cl help <cmd> for more details.