https://github.com/mitranim/repr
[MOVED] Pretty-print Go data structures as valid Go code
https://github.com/mitranim/repr
code-generation go golang pretty-print
Last synced: 6 months ago
JSON representation
[MOVED] Pretty-print Go data structures as valid Go code
- Host: GitHub
- URL: https://github.com/mitranim/repr
- Owner: mitranim
- License: unlicense
- Created: 2018-10-22T07:18:39.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-26T17:18:37.000Z (over 2 years ago)
- Last Synced: 2025-04-26T06:56:57.560Z (6 months ago)
- Topics: code-generation, go, golang, pretty-print
- Language: Go
- Homepage: https://github.com/mitranim/gg/tree/main/grepr
- Size: 42 KB
- Stars: 13
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## MOVED
**Better up-to-date version: https://github.com/mitranim/gg/tree/main/grepr.**
**This repository is now outdated and frozen.**
----
## 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; direct alternative to https://github.com/shurcooL/go-goon.
See godoc at https://godoc.org/github.com/mitranim/repr.
## Example
```go
import "github.com/mitranim/repr"type Data struct {
Number int
String string
List []int
}repr.Println(Data{
Number: 123,
String: "hello world!",
List: []int{10, 20, 30},
})/*
Data{
Number: 123,
String: "hello world!",
List: []int{10, 20, 30},
}
*/
```See the API documentation at https://godoc.org/github.com/mitranim/repr.
## License
https://unlicense.org
## Misc
I'm receptive to suggestions. If this package _almost_ satisfies you but needs changes, open an issue or chat me up. Contacts: https://mitranim.com/#contacts