aquasecurity / aquasecurity/table
SetHeaderColSpans use with many headers bug
- Dominant language
- Go
- Stars
- 132
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
I don't know if I'm using `SetHeaderColSpans` correctly, but the layout is off:
Source ([playground](https://go.dev/play/p/zq3MMASfoSG)):
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaderColSpans(0, 2)
t.SetHeaderColSpans(1, 2)
t.AddHeaders("Header 1")
t.AddHeaders("Header 2")
t.AddHeaders("Header 3", "Header 4")
t.AddRow("Col 1", "Col 2")
t.AddFooters("Footer 1", "Footer 2")
t.Render()
}
```
Outputs:
```sh
┌─────────────────────┐
│ Header 1 │
├────────────────────────┤
│ Header 2 │
├──────────┬──────────┤
│ Header 3 │ Header 4 │
├──────────┼──────────┤
│ Col 1 │ Col 2 │
├──────────┼──────────┤
│ Footer 1 │ Footer 2 │
└──────────┴──────────┘
```
Expected:
```sh
┌─────────────────────┐
│ Header 1 │
├─────────────────────┤
│ Header 2 │
├──────────┬──────────┤
│ Header 3 │ Header 4 │
├──────────┼──────────┤
│ Col 1 │ Col 2 │
├──────────┼──────────┤
│ Footer 1 │ Footer 2 │
└──────────┴──────────┘
```
Contributor guide
Research direction
Start by running the linked Go playground reproduction and trace the SetHeaderColSpans entry point through table rendering. The fix is done when multiple spanned headers produce borders aligned with the two-column rows and a regression test covers the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100