<![endif] Archive Submit an Accidentally Quadratic Accidentally Quadratic `godoc` struct rendering godoc is Go’s tool for extracting doc comments from source code and rendering HTML documentation (loosely parallel Java’s “javadoc”). godoc processes Go struct definitions in two passes. First, it runs over the AST recursively building rendering documentation and declarations into a textual output buffer containing an HTML fragment. The walker for this pass is shared with the rest of godoc ’s documentation rendering (so that e.g. top-level definitions and struct fields share the bulk of their rendering code). Then, it performs a second pass, modifying the HTML to add anchors to field names, so that e.g. https://golang.org/pkg/net/http/#Response.Header links specifically to the Header field in the Response struct. Unfortunately, previ...