Google Code, etc. • Displays docs, usage examples (automatically extracted/ranked), and annotated source code • Shows who uses your code, or specific functions • And now...lists all* implementations of a Go interface Sunday, November 10, 13
"code.google.com/p/go.tools/go/types" ) • Iterate through each scope, assigning each symbol (“anything that can be documented”) a unique URI • Walk the AST, resolving every Ident to its referent symbol URI Sunday, November 10, 13
Repo repo.URI Path SymbolPath Lang sg.Lang } type Symbol struct { SymbolURI; ... } type Ref struct { Dst SymbolURI; Src FileLocation; ... } • Each symbol is uniquely keyed on (repo, path, lang) • Each ref maps a char range in a file to a symbol Sunday, November 10, 13
OfSymbol SymbolURI Repo repo.URI CanonicalSignature string } • Store the pointer method set signatures of each type, as determined by go/types Sunday, November 10, 13
PostgreSQL (using lib/pq and coopernurse/gorp) • ... • Handle a million edge cases (versions, deps, syntax errors, cgo, forks, etc.) • Repeat for all 50,000+ Go repositories out there • Then do the same for other languages Sunday, November 10, 13
code? • What types implement http.ResponseWriter? • What interfaces does tls.Conn implement? ✱ Sourcegraph https://sourcegraph.com Sunday, November 10, 13