An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.1% on proxy.golang.org
Top 4.7% dependent repos on proxy.golang.org
Top 9.0% forks on proxy.golang.org

proxy.golang.org : github.com/mitranim/repr

Overview Prints Go data structures as syntactically valid Go code. Useful for code generation. The name "repr" stands for "representation" and alludes to the Python function with the same name. Solves a problem unaddressed by https://github.com/davecgh/go-spew/spew and directly competes with https://github.com/shurcooL/go-goon Has no dependencies outside the standard library. Motives: • Dumping data as code is useful for code generation and debugging. • fmt.Sprintf("%#v") doesn't always output valid code, has no multiline mode. • https://github.com/davecgh/go-spew/spew doesn't output valid code, has no single-line mode. • https://github.com/shurcooL/go-goon outputs too much noise, has no single-line mode. Supports single-line and multiline modes. Defaults to multiline. The output looks like something you'd write by hand, and is almost exactly compliant with gofmt. Unlike gofmt, it doesn't align field values in struct literals. Use "go/format" to fix that, at a 50x performance cost: Zero-initialized fields in structs are omitted by default (configurable). Bytes are printed in hex notation. In multiline mode, byte arrays have 8 bytes per row: Supports package renaming, which is useful for code generation. See Config for details. Some of these limitations may be lifted in future versions. • Fancy types such as "big.Int" or "time.Time" are printed as empty structs; ideally they would be printed as constructor calls. • Funcs are treated as nil. • Chans are treated as nil. • Pointers to primitive types are not supported and cause a panic. • "byte" is printed as "uint8". • "rune" is printed as "int32". • Runes are printed as integers, not character literals. • Enum-style constants are not mapped back to identifers. • On structs, only exported fields are included. • Cyclic structures cause infinite recursion. • Doesn't support `fmt.GoStringer` yet. Note: pointers to composite types such as structs, arrays, slices and maps are supported by prefixing literals with "&", but Go currently doesn't support this for primitive literals. Shell: Example:

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/mitranim/repr
Keywords: code-generation , go , golang , pretty-print
License: Unlicense
Latest release: about 3 years ago
First release: over 5 years ago
Namespace: github.com/mitranim
Dependent repositories: 1
Stars: 13 on GitHub
Forks: 4 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 21 days ago

    Loading...
    Readme
    Loading...