Help us shape the future of Go! Take the 2026 Go Developer Survey

tabular

package
v1.126.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package tabular parses delimited tabular text (CSV or TSV) into a header-plus-rows structure. It decodes UTF-8/UTF-16 byte-order marks and auto-detects whether the delimiter is a comma or a tab, so it handles output from tools like Sysinternals sigcheck as well as generic CSV/TSV files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Table

type Table struct {
	Header []string
	// Rows holds one map per data row, keyed by header column. If the header
	// contains duplicate column names, the last column wins.
	Rows []map[string]string
}

Table is parsed tabular data: the header columns and one map per data row, keyed by header column.

func Parse

func Parse(raw []byte) (*Table, error)

Parse decodes delimited CSV/TSV text. It strips/decodes UTF-8 and UTF-16 byte-order marks and auto-detects whether the delimiter is a comma or a tab.

func (*Table) Column

func (t *Table) Column(name string) ([]string, bool)

Column returns the values of the column whose header matches name case-insensitively (trimming surrounding whitespace), with empty and whitespace-only cells dropped, and whether such a column exists.

func (*Table) HasColumns

func (t *Table) HasColumns(cols ...string) bool

HasColumns reports whether every named column is present in the header.

func (*Table) JSON

func (t *Table) JSON() ([]byte, error)

JSON marshals the table rows as a JSON array. A header-only table marshals to "[]".

Jump to

Keyboard shortcuts

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