aquasecurity / aquasecurity/table

content col span

Open
#24 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
132
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Hello. Can you give me examlpe, how can i use setColSpans function. I have panic, when use like this:

> t := table.New(os.Stdout)
> t.SetHeaders("Service", "Critical", "High", "Medium", "Low", "Unknown", "Last Scanned")
> t.AddRow("ec2", "1")
> t.AddRow("ec3")
> t.AddRow("ec2", "1")
> t.AddRow("eks", "7")
> t.SetColSpans(0, 1, 6)
> t.Render()

panic: runtime error: index out of range [7] with length 7

When use like this:

> t := table.New(os.Stdout)
> t.SetHeaders("Service", "Critical", "High", "Medium", "Low", "Unknown", "Last Scanned")
> t.AddRow("ec2", "1")
> t.AddRow("ec3")
> t.AddRow("ec2", "1")
> t.AddRow("eks", "7")
> t.SetColSpans(0, 1, 6)
> t.SetColSpans(1, 1, 6)
> t.Render()

i have:
![Screenshot 2023-10-11 124057](https://github.com/aquasecurity/table/assets/83408003/477dcb67-d7dd-47e7-a6af-98e67cac869d)

But when use like this:

> t := table.New(os.Stdout)
> t.SetHeaders("Service", "Critical", "High", "Medium", "Low", "Unknown", "Last Scanned")
> t.AddRow("ec2", "1")
> t.AddRow("ec3")
> t.AddRow("ec2", "1")
> t.AddRow("eks", "7")
> t.SetColSpans(0, 1, 6)
> t.SetColSpans(1, 1, 6)
> t.SetColSpans(2, 1, 6)
> t.Render()

again panic:
panic: runtime error: index out of range [7] with length 7

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided Go snippets with SetColSpans and Render, then inspect those entry points to determine why the span exceeds the seven columns. Done means the examples no longer panic and the supported SetColSpans usage is clear.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.