---
title: "table: short rows in SetRows for Go CLI tables | VulCode"
description: "A fix in the table library in Go: SetRows pads short rows to the number of columns, so a CLI table no longer prints %!s(MISSING) or panics on empty rows."
url: "https://vulcode.com/en/opensource/contributions/rodaine-table"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/contributions)

rodaine/table

# rodaine/table

A table generator for Go command line apps that aligns columns and lets you format the first column.

[See the repository](https://github.com/rodaine/table) [All contributions](https://vulcode.com/en/opensource/contributions)

- **Language**: Go
- **GitHub stars**: 325
- **Merged changes**: 1

## What we changed

SetRows pads short rows with empty cells to the number of columns, as AddRow does, so the table no longer shows %!s(MISSING) and an empty row no longer panics.

### What this work shows

- CLI output formatting with fmt

- Go library API consistency

- Regression tests with testify

What was broken

### A short row broke the table

SetRows stored rows shorter than the number of columns as they were. The missing cells printed as %!s(MISSING), and an empty row with a first-column formatter panicked with "index out of range", although the docs promised empty cells.

How we fixed it

### Padding like AddRow

A short row is copied into a new slice as long as the header, so the missing columns are empty, as with AddRow. Two tests check the exact output for a short row and that an empty row does not panic.

[#67](https://github.com/rodaine/table/pull/67)

## Merged change 1

- [#67 fix: pad short rows in SetRows to the number of columns Merged 14 September 2026](https://github.com/rodaine/table/pull/67)

## What it taught us

Two methods that do the same job must follow the same rule: the docs promised empty cells, AddRow delivered them and SetRows did not. A test that fails without the fix shows that it fixes exactly this bug.

[More about this technology: Golang](https://vulcode.com/en/technologies/go)

## Other projects we write code for

- [**urfave/cli** Go · 24,329 stars A declarative Go package for building command line tools.](https://vulcode.com/en/opensource/contributions/urfave-cli)

- [**chezmoi** Go · 22,342 stars A dotfiles manager that keeps the same settings on many different machines, securely.](https://vulcode.com/en/opensource/contributions/chezmoi)

- [**goquery** Go · 14,995 stars A Go library for traversing and changing HTML documents in the style of jQuery, built on the golang.org/x/net/html parser.](https://vulcode.com/en/opensource/contributions/goquery)

- [**Ebitengine** Go · 13,647 stars A 2D game engine in Go, used in games released for computers, phones, browsers and consoles.](https://vulcode.com/en/opensource/contributions/ebiten)

- [**Fission** Go · 8,950 stars A serverless functions framework for Kubernetes that runs code as functions and scales them down to zero when they are idle.](https://vulcode.com/en/opensource/contributions/fission)

- [**Concourse** Go · 7,944 stars A container-based automation system written in Go and used mostly for CI/CD. Pipelines and tasks are described in YAML files.](https://vulcode.com/en/opensource/contributions/concourse)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
