type cell … type Writer … // addLine adds a new line. // flushed is a hint indicating whether the underlying writer was just flushed. // If so, the previous line is not likely to be a good indicator of the new line's cells. func (b *Writer) addLine(flushed bool) { … } // Reset the current state. func (b *Writer) reset() { … } const FilterHTML … const StripEscape … const AlignRight … const DiscardEmptyColumns … const TabIndent … const Debug … const RememberWidths … // A Writer must be initialized with a call to Init. The first parameter (output) // specifies the filter output. The remaining parameters control the formatting: // // minwidth minimal cell width including any padding // tabwidth width of tab characters (equivalent number of spaces) // padding padding added to a cell before computing its width // padchar ASCII char used for padding // if padchar == '\t', the Writer will assume that the // width of a '\t' in the formatted output is tabwidth, // and cells are left-aligned independent of align_left // (for correct-looking results, tabwidth must correspond // to the tab width in the viewer displaying the result) // flags formatting control // func (b *Writer) Init(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *Writer { … } // debugging support (keep code around) func (b *Writer) dump() { … } type osError … func (b *Writer) write0(buf []byte) { … } func (b *Writer) writeN(src []byte, n int) { … } var newline … var tabs … func (b *Writer) writePadding(textw, cellw int, useTabs bool) { … } var vbar … func (b *Writer) writeLines(pos0 int, line0, line1 int) (pos int) { … } // Format the text between line0 and line1 (excluding line1); pos // is the buffer position corresponding to the beginning of line0. // Returns the buffer position corresponding to the beginning of // line1 and an error, if any. // func (b *Writer) format(pos0 int, line0, line1 int) (pos int) { … } // Append text to current cell. func (b *Writer) append(text []byte) { … } // Update the cell width. func (b *Writer) updateWidth() { … } const Escape … // Start escaped mode. func (b *Writer) startEscape(ch byte) { … } // Terminate escaped mode. If the escaped text was an HTML tag, its width // is assumed to be zero for formatting purposes; if it was an HTML entity, // its width is assumed to be one. In all other cases, the width is the // unicode width of the text. // func (b *Writer) endEscape() { … } // Terminate the current cell by adding it to the list of cells of the // current line. Returns the number of cells in that line. // func (b *Writer) terminateCell(htab bool) int { … } func handlePanic(err *error, op string) { … } // RememberedWidths returns a copy of the remembered per-column maximum widths. // Requires use of the RememberWidths flag, and is not threadsafe. func (b *Writer) RememberedWidths() []int { … } // SetRememberedWidths sets the remembered per-column maximum widths. // Requires use of the RememberWidths flag, and is not threadsafe. func (b *Writer) SetRememberedWidths(widths []int) *Writer { … } // Flush should be called after the last call to Write to ensure // that any data buffered in the Writer is written to output. Any // incomplete escape sequence at the end is considered // complete for formatting purposes. func (b *Writer) Flush() error { … } func (b *Writer) flush() (err error) { … } var hbar … // Write writes buf to the writer b. // The only errors returned are ones encountered // while writing to the underlying output stream. // func (b *Writer) Write(buf []byte) (n int, err error) { … } // NewWriter allocates and initializes a new tabwriter.Writer. // The parameters are the same as for the Init function. // func NewWriter(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *Writer { … }