Skip to content

View type information from your program in your browser!

License

Notifications You must be signed in to change notification settings

arnehormann/typebrowser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typebrowser

View type information from your program in your browser!

Typebrowser is a modern variant of println-debugging. Instead of debug outputs on some lines scrolling faster than you can say ... anything, it conviniently stops everything to let you see what's happening inside.

For now, this is restricted to type information.

How do I use this?

Call NewTypeServer and stuff things into the channel. Open your browser and point it to the port you specify. It's pretty simple.

import (
	// import it
	"github.com/arnehormann/typebrowser"
)

// start it
var typechan = typebrowser.NewTypeServer(":8080")

...
	// use it - feed anything to it!
	typechan <- myvar
	// if you want to know where in your program this is called from:
	typechan <- typebrowser.Type{myvar, `some file, some line, some state`}
...

Typebrowser can be installed by go get github.com/arnehormann/typebrowser.

It depends on mirror, go-gettable with go get github.com/arnehormann/mirror.

When you use it, it shows a site with one button per export format. The next type is fetched with an http-post, your program stops because it blocks on the channel read until the next type is requested.

For a working code example, see example/example.go.

For a peek at what the html output looks like, see this demo for *reflect.StructField.

Types containing others are foldable on click.

JSON output is next on my agenda.

License: MPL2.

About

View type information from your program in your browser!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages