Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(table): SuppressTrailingSpaces also removed spaces from the beginning #295

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

ilya-lesikov
Copy link
Contributor

Proposed Changes

mytable.SuppressTrailingSpaces() suppressing not only trailing spaces, but also spaces from the beginning. This fixes it.

Before fix

RESOURCE (→READY)               STATE    INFO
Deployment/lesikovtestttt       WAITING  Ready:0/1
• Pod/lesikovtestttt-78568f8d  CREATED  Status:CrashLoopBack
77-dkznh                                 Off  Errors:1  LastE
rror:"CrashLoopBackO
ff: back-off 5m0s re
starting failed cont
ainer=alpine pod=les
ikovtestttt-78568f8d
77-dkznh_nelm-basic(
a1e1ac7e-c64d-4531-9
d0d-b20b5e9f0a61)"

After fix

RESOURCE (→READY)               STATE    INFO
Deployment/lesikovtestttt       WAITING  Ready:0/1
 • Pod/lesikovtestttt-78568f8d  CREATED  Status:CrashLoopBack
77-dkznh                                 Off  Errors:1  LastE
                                         rror:"CrashLoopBackO
                                         ff: back-off 2m40s r
                                         estarting failed con
                                         tainer=alpine pod=le
                                         sikovtestttt-78568f8
                                         d77-dkznh_nelm-basic
                                         (a1e1ac7e-c64d-4531-
                                         9d0d-b20b5e9f0a61)"

@ilya-lesikov
Copy link
Contributor Author

I see some units failing since they for some reason expect SuppressTrailingSpaces to also remove spaces in the beginning. I'll fix the tests if you are fine with the PR.

@jedib0t
Copy link
Owner

jedib0t commented Jan 25, 2024

@ilya-lesikov Code looks okay to me, but you have to fix the failing unit-test along with it. Change the code in the test from:

	tw.Style().Options = OptionsNoBordersAndSeparators
	compareOutput(t, tw.Render(), `
ID    TEXT1                                   DATE              TEXT2
U2    Hey                                     2021-04-19 13:37  Yuh yuh yuh
S12   Uhhhh                                   2021-04-19 13:37  Some dummy data here
R123  Lobsters                                2021-04-19 13:37  I like lobsters
R123  Some big name here and it's pretty big  2021-04-19 13:37  Abcdefghijklmnopqrstuvwxyz
R123  Small name                              2021-04-19 13:37  Abcdefghijklmnopqrstuvwxyz`)

to:

	tw.Style().Options = OptionsNoBordersAndSeparators
	compareOutput(t, tw.Render(), `
 ID    TEXT1                                   DATE              TEXT2
 U2    Hey                                     2021-04-19 13:37  Yuh yuh yuh
 S12   Uhhhh                                   2021-04-19 13:37  Some dummy data here
 R123  Lobsters                                2021-04-19 13:37  I like lobsters
 R123  Some big name here and it's pretty big  2021-04-19 13:37  Abcdefghijklmnopqrstuvwxyz
 R123  Small name                              2021-04-19 13:37  Abcdefghijklmnopqrstuvwxyz`)

The new code has leading spaces in each line of output.

Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
@ilya-lesikov ilya-lesikov force-pushed the fix-table-supress-trailing-spaces branch from 7170e18 to 6735efc Compare January 29, 2024 13:14
Copy link

sonarcloud bot commented Jan 29, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@coveralls
Copy link

Pull Request Test Coverage Report for Build 7696662338

  • 0 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 7456312488: 0.0%
Covered Lines: 3434
Relevant Lines: 3434

💛 - Coveralls

@ilya-lesikov
Copy link
Contributor Author

@jedib0t Fixed units.

@jedib0t jedib0t merged commit cc6c24d into jedib0t:main Jan 29, 2024
3 checks passed
@jedib0t
Copy link
Owner

jedib0t commented Jan 29, 2024

Thanks for the contribution @ilya-lesikov !

@jedib0t
Copy link
Owner

jedib0t commented Jan 29, 2024

I've cut a release for your use: https://github.com/jedib0t/go-pretty/releases/tag/v6.5.4

another-rex pushed a commit to google/osv-scanner that referenced this pull request Feb 5, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change | Age | Adoption | Passing |
Confidence |
|---|---|---|---|---|---|---|---|
| [deps.dev/api/v3alpha](https://togithub.com/google/deps.dev) | require
| digest | `00b51ef` -> `c339c64` |
[![age](https://developer.mend.io/api/mc/badges/age/go/deps.dev%2fapi%2fv3alpha/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/deps.dev%2fapi%2fv3alpha/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/deps.dev%2fapi%2fv3alpha/v0.0.0-20240109042716-00b51ef52ece/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/deps.dev%2fapi%2fv3alpha/v0.0.0-20240109042716-00b51ef52ece/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [deps.dev/util/resolve](https://togithub.com/google/deps.dev) |
require | digest | `00b51ef` -> `c339c64` |
[![age](https://developer.mend.io/api/mc/badges/age/go/deps.dev%2futil%2fresolve/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/deps.dev%2futil%2fresolve/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/deps.dev%2futil%2fresolve/v0.0.0-20240109042716-00b51ef52ece/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/deps.dev%2futil%2fresolve/v0.0.0-20240109042716-00b51ef52ece/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [deps.dev/util/semver](https://togithub.com/google/deps.dev) | require
| digest | `1e316b8` -> `c339c64` |
[![age](https://developer.mend.io/api/mc/badges/age/go/deps.dev%2futil%2fsemver/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/deps.dev%2futil%2fsemver/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/deps.dev%2futil%2fsemver/v0.0.0-20240109040450-1e316b822bc4/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/deps.dev%2futil%2fsemver/v0.0.0-20240109040450-1e316b822bc4/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[github.com/gkampitakis/go-snaps](https://togithub.com/gkampitakis/go-snaps)
| require | minor | `v0.4.12` -> `v0.5.2` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgkampitakis%2fgo-snaps/v0.5.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fgkampitakis%2fgo-snaps/v0.5.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fgkampitakis%2fgo-snaps/v0.4.12/v0.5.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgkampitakis%2fgo-snaps/v0.4.12/v0.5.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[github.com/ianlancetaylor/demangle](https://togithub.com/ianlancetaylor/demangle)
| require | digest | `964b1d5` -> `1f824a1` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fianlancetaylor%2fdemangle/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fianlancetaylor%2fdemangle/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fianlancetaylor%2fdemangle/v0.0.0-20240117034632-964b1d53ca6c/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fianlancetaylor%2fdemangle/v0.0.0-20240117034632-964b1d53ca6c/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[github.com/jedib0t/go-pretty/v6](https://togithub.com/jedib0t/go-pretty)
| require | patch | `v6.5.3` -> `v6.5.4` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fjedib0t%2fgo-pretty%2fv6/v6.5.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fjedib0t%2fgo-pretty%2fv6/v6.5.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fjedib0t%2fgo-pretty%2fv6/v6.5.3/v6.5.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fjedib0t%2fgo-pretty%2fv6/v6.5.3/v6.5.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [go](https://go.dev/) ([source](https://togithub.com/golang/go)) |
golang | patch | `1.21.5` -> `1.21.6` |
[![age](https://developer.mend.io/api/mc/badges/age/golang-version/go/1.21.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/golang-version/go/1.21.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/golang-version/go/1.21.5/1.21.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/golang-version/go/1.21.5/1.21.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| golang.org/x/exp | require | digest | `1b97071` -> `2c58cdc` |
[![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fexp/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/golang.org%2fx%2fexp/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/golang.org%2fx%2fexp/v0.0.0-20240119083558-1b970713d09a/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fexp/v0.0.0-20240119083558-1b970713d09a/?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [google.golang.org/grpc](https://togithub.com/grpc/grpc-go) | require
| minor | `v1.60.1` -> `v1.61.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/google.golang.org%2fgrpc/v1.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/google.golang.org%2fgrpc/v1.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/google.golang.org%2fgrpc/v1.60.1/v1.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/google.golang.org%2fgrpc/v1.60.1/v1.61.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[google.golang.org/protobuf](https://togithub.com/protocolbuffers/protobuf-go)
| require | minor | `v1.31.0` -> `v1.32.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/google.golang.org%2fprotobuf/v1.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/google.golang.org%2fprotobuf/v1.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/google.golang.org%2fprotobuf/v1.31.0/v1.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/google.golang.org%2fprotobuf/v1.31.0/v1.32.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>gkampitakis/go-snaps
(github.com/gkampitakis/go-snaps)</summary>

###
[`v0.5.2`](https://togithub.com/gkampitakis/go-snaps/compare/v0.5.1...v0.5.2)

[Compare
Source](https://togithub.com/gkampitakis/go-snaps/compare/v0.5.1...v0.5.2)

###
[`v0.5.1`](https://togithub.com/gkampitakis/go-snaps/releases/tag/v0.5.1)

[Compare
Source](https://togithub.com/gkampitakis/go-snaps/compare/v0.5.0...v0.5.1)

#### What's Changed

- fix: replace `Print` with `Println` by
[@&#8203;G-Rath](https://togithub.com/G-Rath) in
[gkampitakis/go-snaps#94

**Full Changelog**:
gkampitakis/go-snaps@v0.5.0...v0.5.1

###
[`v0.5.0`](https://togithub.com/gkampitakis/go-snaps/releases/tag/v0.5.0)

[Compare
Source](https://togithub.com/gkampitakis/go-snaps/compare/v0.4.12...v0.5.0)

#### What's Changed

- docs: improve readme code formatting and grammar by
[@&#8203;G-Rath](https://togithub.com/G-Rath) in
[gkampitakis/go-snaps#85
- docs: improve `TestMain` references by
[@&#8203;G-Rath](https://togithub.com/G-Rath) in
[gkampitakis/go-snaps#86
- chore(docs): minor improvements by
[@&#8203;gkampitakis](https://togithub.com/gkampitakis) in
[gkampitakis/go-snaps#89
- chore: clean up test mocks and change getTestID param order by
[@&#8203;gkampitakis](https://togithub.com/gkampitakis) in
[gkampitakis/go-snaps#92
- feat: don't create multiple snapshots when -test.count>1 by
[@&#8203;gkampitakis](https://togithub.com/gkampitakis) in
[gkampitakis/go-snaps#90

#### Breaking changes ❗

On `v0.5.0` when running tests with `test.count>1` flag a call to create
a snapshot will not create multiple instances of the same snapshot, but
it will create the snapshot once and then subsequent execution will test
against that snapshot. Look at issue
[gkampitakis/go-snaps#87

#### New Contributors

- [@&#8203;G-Rath](https://togithub.com/G-Rath) made their first
contribution in
[gkampitakis/go-snaps#85

**Full Changelog**:
gkampitakis/go-snaps@v0.4.12...v0.5.0

</details>

<details>
<summary>jedib0t/go-pretty (github.com/jedib0t/go-pretty/v6)</summary>

###
[`v6.5.4`](https://togithub.com/jedib0t/go-pretty/releases/tag/v6.5.4)

[Compare
Source](https://togithub.com/jedib0t/go-pretty/compare/v6.5.3...v6.5.4)

#### What's Changed

- table: fix SuppressTrailingSpaces removing spaces from the beginning
by [@&#8203;ilya-lesikov](https://togithub.com/ilya-lesikov) in
[jedib0t/go-pretty#295
- table: fix documentation for merges by
[@&#8203;jedib0t](https://togithub.com/jedib0t) in
[jedib0t/go-pretty#296

#### New Contributors

- [@&#8203;ilya-lesikov](https://togithub.com/ilya-lesikov) made their
first contribution in
[jedib0t/go-pretty#295

**Full Changelog**:
jedib0t/go-pretty@v6.5.3...v6.5.4

</details>

<details>
<summary>golang/go (go)</summary>

###
[`v1.21.6`](https://togithub.com/golang/go/compare/go1.21.5...go1.21.6)

</details>

<details>
<summary>grpc/grpc-go (google.golang.org/grpc)</summary>

### [`v1.61.0`](https://togithub.com/grpc/grpc-go/releases/tag/v1.61.0):
Release 1.61.0

[Compare
Source](https://togithub.com/grpc/grpc-go/compare/v1.60.1...v1.61.0)

### New Features

- resolver: provide method, `AuthorityOverrider`, to allow
resolver.Builders to override the default authority for a `ClientConn`.
(EXPERIMENTAL)
([#&#8203;6752](https://togithub.com/grpc/grpc-go/issues/6752))
- Special Thanks:
[@&#8203;Aditya-Sood](https://togithub.com/Aditya-Sood)
- xds: add support for mTLS Credentials in xDS bootstrap ([gRFC
A65](github.com/grpc/proposal/blob/8c31bfedded5f0a51c4933e9e9a8246122f9c41a/A65-xds-mtls-creds-in-bootstrap.md))
([#&#8203;6757](https://togithub.com/grpc/grpc-go/issues/6757))
- Special Thanks: [@&#8203;atollena](https://togithub.com/atollena)
- server: add `grpc.WaitForHandlers` `ServerOption` to cause
`Server.Stop` to block until method handlers return. (EXPERIMENTAL)
([#&#8203;6922](https://togithub.com/grpc/grpc-go/issues/6922))

### Performance Improvements

- grpc: skip compression of empty messages as an optimization
([#&#8203;6842](https://togithub.com/grpc/grpc-go/issues/6842))
    -   Special Thanks: [@&#8203;jroper](https://togithub.com/jroper)
- orca: use atomic pointer to improve performance in server metrics
recorder ([#&#8203;6799](https://togithub.com/grpc/grpc-go/issues/6799))
- Special Thanks:
[@&#8203;danielzhaotongliu](https://togithub.com/danielzhaotongliu)

### Bug Fixes

- client: correctly enable TCP keepalives with OS defaults on windows
([#&#8203;6863](https://togithub.com/grpc/grpc-go/issues/6863))
- Special Thanks: [@&#8203;mmatczuk](https://togithub.com/mmatczuk)
- server: change some stream operations to return `UNAVAILABLE` instead
of `UNKNOWN` when underlying connection is broken
([#&#8203;6891](https://togithub.com/grpc/grpc-go/issues/6891))
- Special Thanks:
[@&#8203;mustafasen81](https://togithub.com/mustafasen81)
- server: fix `GracefulStop` to block until all method handlers return
(v1.60 regression).
([#&#8203;6922](https://togithub.com/grpc/grpc-go/issues/6922))
- server: fix two bugs that could lead to panics at shutdown when using
[`NumStreamWorkers`](https://pkg.go.dev/google.golang.org/grpc#NumStreamWorkers)
(EXPERIMENTAL).
([#&#8203;6856](https://togithub.com/grpc/grpc-go/issues/6856))
- reflection: do not send invalid descriptors to clients for files that
cannot be fully resolved
([#&#8203;6771](https://togithub.com/grpc/grpc-go/issues/6771))
    -   Special Thanks: [@&#8203;jhump](https://togithub.com/jhump)
- xds: don't fail channel/server startup when xds creds is specified,
but bootstrap is missing certificate providers
([#&#8203;6848](https://togithub.com/grpc/grpc-go/issues/6848))
- xds: Atomically read and write xDS security configuration client side
([#&#8203;6796](https://togithub.com/grpc/grpc-go/issues/6796))
- xds/server: fix RDS handling for non-inline route configs
([#&#8203;6915](https://togithub.com/grpc/grpc-go/issues/6915))

</details>

<details>
<summary>protocolbuffers/protobuf-go
(google.golang.org/protobuf)</summary>

###
[`v1.32.0`](https://togithub.com/protocolbuffers/protobuf-go/releases/tag/v1.32.0)

[Compare
Source](https://togithub.com/protocolbuffers/protobuf-go/compare/v1.31.0...v1.32.0)

**Full Changelog**:
protocolbuffers/protobuf-go@v1.31.0...v1.32.0

This release contains commit
protocolbuffers/protobuf-go@bfcd647,
which fixes a denial of service vulnerability by preventing a stack
overflow through a default maximum recursion limit. See
[golang/protobuf#1583
and
[golang/protobuf#1584
for details.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 6am on monday" in timezone
Australia/Sydney, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/google/osv-scanner).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants