Go: cmd/internal/test2json Index | Files

package test2json

import "cmd/internal/test2json"

Package test2json implements conversion of test binary output to JSON. It is used by cmd/test2json and cmd/go.

See the cmd/test2json documentation for details of the JSON encoding.


Package Files


func NewConverter Uses

func NewConverter(w io.Writer, pkg string, mode Mode) io.WriteCloser

NewConverter returns a "test to json" converter. Writes on the returned writer are written as JSON to w, with minimal delay.

The writes to w are whole JSON events ending in \n, so that it is safe to run multiple tests writing to multiple converters writing to a single underlying output stream w. As long as the underlying output w can handle concurrent writes from multiple goroutines, the result will be a JSON stream describing the relative ordering of execution in all the concurrent tests.

The mode flag adjusts the behavior of the converter. Passing ModeTime includes event timestamps and elapsed times.

The pkg string, if present, specifies the import path to report in the JSON stream.

type Mode Uses

type Mode int

Mode controls details of the conversion.

const (
    Timestamp Mode = 1 << iota // include Time in events

Package test2json imports 9 packages (graph) and is imported by 6 packages. Updated 2020-08-09. Refresh now. Tools for package owners.