Skip to content

backdround/go-typeprinter

Repository files navigation

Go Reference Tests Codecov Go Report

Type printer

Package present type in pretty and simple string.

Installation

go get github.com/backdround/go-typeprinter

Example

package main

import (
	"fmt"
	"github.com/backdround/go-typeprinter"
)

type Person struct {
	name string
	age  int
	work struct {
		post  string
		floor int
	}
}

func main() {
	p := Person{
		name: "bob",
		age:  20,
		work: struct {
			post  string
			floor int
		}{
			post:  "boss",
			floor: 32,
		},
	}

	fmt.Print(typeprinter.Sprint(p))
}

Output:

Person {
	name: "bob"
	age: 20
	work {
		post: "boss"
		floor: 32
	}
}

About

Go package which simple represent structure.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages