gotfmt

command module
v0.0.0-...-8d1c8a5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2015 License: BSD-2-Clause Imports: 5 Imported by: 0

README

gotfmt: Go stack trace formatter library and utilities

This is a simple parser library and utilities for GOTRACEBACK output Also there is Web UI with demo: http://gotfmt.appspot.com/

Installation

Just type the following to install the program and its dependencies:

$ go get -u github.com/t-yuki/gotfmt/...

If you want to install commands separately, just:

$ go get -u github.com/t-yuki/gotfmt
$ go get -u github.com/t-yuki/gotfmt/cmd/got

Usage

gotfmt formats stack trace texts pretty:

$ go test -timeout=1us |& gotfmt

got or gotfmt test runs go test and formats its stack trace texts.

$ got -timeout=1us
$ gotfmt test -timeout=1us

gotfmt -http=:6060 runs Web UI:

$ gotfmt -http=:6060

Other options:

gotfmt - Go Test formatter utility
Usage of gotfmt [test|FILE]:
  If test is provided, it runs `go test` internally.
  Other flags or arguments will be passed to `go` command.
  If FILE is exists, it reads the test result from FILE.

  -f="trimstd,notest": stack trace filters by comma-separated list
        trimstd:  exclude GOROOT function calls but leave one
        nostd:    exclude GOROOT function calls completely
        notest:   exclude testing function calls
        top:      remove lower function calls
  -h=false: show this help
  -http="": HTTP service address (e.g., ':6060')
  -n=1: repeat the test N times while it passes
  -np=0: similar to a combination of `-n` and `-p` but increment GOMAXPROCS from 1 for each repeat
  -p=0: set GOMAXPROCS
  -t="pretty": output format
        raw: as-is and no filtering
        text: filtered GOTRACEBACK style
        pretty: pretty formatted text
        qfix: vim quickfix output format with errorformat: '%f:%l:\ %m'. you should use with 'nostd,notest,top' filters
        json: JSON format

Tips

Command Alias

Since gotfmt XXX while XXX is not test runs go XXX command and does nothing, you can use it as go command alias.

alias go="gotfmt" # `go test` will runs `go test` and formats its output, other options bypasses gotfmt command.
VIM

qfix output format generates quickfix list.

# .vimrc: auto FileType go set errorformat=%f:%l:\ %m
$ go test -timeout=3s |& gotfmt -f=nostd,notest,top -t=qfix | vim - -c :cb! -c :copen

Web UI Demo

The below is web-based analyzer. It is running gotfmt -http=:80 command.

http://gotfmt.appspot.com/

Authors

Thanks

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
got
thirdparty

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL