镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

About

View type information from your program in your browser!

Resources

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

 

History

25 Commits

Folders and files

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

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages