Skip to content

Bump github.com/olekukonko/tablewriter from 0.0.5 to 1.0.4 #874

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

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github May 13, 2025

Bumps github.com/olekukonko/tablewriter from 0.0.5 to 1.0.4.

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [github.com/olekukonko/tablewriter](https://github.com/olekukonko/tablewriter) from 0.0.5 to 1.0.4.
- [Commits](olekukonko/tablewriter@v0.0.5...v1.0.4)

---
updated-dependencies:
- dependency-name: github.com/olekukonko/tablewriter
  dependency-version: 1.0.4
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately it is impossible to produce the output that is required for the arduino-lint result output using the new version of the module.

This simple demonstration program using 0.0.5:

package main

import (
	"regexp"
	"strings"

	"github.com/olekukonko/tablewriter"
)

func main() {
	width := 120 // Wrap text to this width
	prefix := "INFO: "
	message := "The original machine had a base-plate of prefabulated aluminite, surmounted by a malleable logarithmic casing in such a way that the two main spurving bearings were in a direct line with the pentametric fan. The latter consisted simply of six hydrocoptic marzlevanes, so fitted to the ambifacient lunar waneshaft that side fumbling was effectively prevented.\nContent after explicit line break."

	formattedOutput := &strings.Builder{}
	table := tablewriter.NewWriter(formattedOutput)
	table.SetBorder(false)
	table.SetColumnSeparator("")
	table.SetNoWhiteSpace(true) // Do not pad cell margins.
	table.SetColWidth(width - len(prefix))
	table.SetReflowDuringAutoWrap(false) // Reflow removes explicit line breaks.
	table.Append([]string{prefix, message})
	table.Render()

	// Remove blank lines on explicit line breaks caused by tablewriter bug.
	blankLineRegexp := regexp.MustCompile("\n[[:space:]]*\n")
	cleanedOutput := blankLineRegexp.ReplaceAllLiteralString(formattedOutput.String(), "\n")

	print(cleanedOutput)
}

produces the expected output:

INFO: The original machine had a base-plate of prefabulated aluminite, surmounted by a malleable logarithmic casing     
      in such a way that the two main spurving bearings were in a direct line with the pentametric fan. The latter
      consisted simply of six hydrocoptic marzlevanes, so fitted to the ambifacient lunar waneshaft that side fumbling
      was effectively prevented.
      Content after explicit line break.

The equivalent program using 1.0.4:

package main

import (
	"strings"

	"github.com/olekukonko/tablewriter"
	"github.com/olekukonko/tablewriter/renderer"
	"github.com/olekukonko/tablewriter/tw"
)

func main() {
	width := 120 // Wrap text to this width
	prefix := "INFO: "
	message := "The original machine had a base-plate of prefabulated aluminite, surmounted by a malleable logarithmic casing in such a way that the two main spurving bearings were in a direct line with the pentametric fan. The latter consisted simply of six hydrocoptic marzlevanes, so fitted to the ambifacient lunar waneshaft that side fumbling was effectively prevented.\nContent after break."

	formattedOutput := &strings.Builder{}

	tableConfigBuilder := tablewriter.NewConfigBuilder()
	tableConfigBuilder.ForColumn(0).WithMaxWidth(len(prefix))
	tableConfigBuilder.ForColumn(1).WithMaxWidth(width - len(prefix))
	tableConfig := tableConfigBuilder.Build()

	tableBorders := tw.Border{
		Left:   tw.Off,
		Right:  tw.Off,
		Top:    tw.Off,
		Bottom: tw.Off,
	}

	tableSettings := tw.Settings{
		Separators: tw.Separators{
			BetweenColumns: tw.Off,
		},
	}

	tableRendition := tw.Rendition{
		// We would expect to be able to do this via the high level tablewriter.WithBorders, but it has no effect.
		Borders: tableBorders,
		// We would expect to be able to do this via the high level tablewriter.WithRendererSettings, but it has no effect.
		Settings: tableSettings,
	}

	tableRenderer := renderer.NewBlueprint(tableRendition)

	table := tablewriter.NewTable(
		formattedOutput,
		tablewriter.WithConfig(tableConfig),
		tablewriter.WithRenderer(tableRenderer),
	)

	table.Append([]string{prefix, message})
	if err := table.Render(); err != nil {
		panic(err)
	}

	print(formattedOutput.String())
}

Produces this output:

 INFO:  The original machine had a base-plate of prefabulated aluminite, surmounted by a malleable logarithmic casing    
        in such a way that the two main spurving bearings were in a direct line with the pentametric fan. The latter     
        consisted simply of six hydrocoptic marzlevanes, so fitted to the ambifacient lunar waneshaft that side fumbling 
        was effectively prevented.                                                                                       
        Content after break.                                                                                             

This output has two separate problems, which confusingly consist of both the presence of unexpected spaces, and the absence of an expected space:

Unwanted Padding

The module forces one unit of padding at the left and right sides of the cell content.

This is the source of the leading space on the output, and the two spaces between the columns.

This has been reported at olekukonko/tablewriter#244 (comment).

Unwanted trimming

The module forces the trimming of whitespace from cells in width constrained tables, even when there is sufficient space for the untrimmed content.

This results in the loss of the intentional trailing space from the result type prefix. The need for that trailing space is not obvious due to the unwanted padding, but will be essential once the padding problem is fixed.

This has been reported at olekukonko/tablewriter#254

@per1234 per1234 added the type: enhancement Proposed improvement label May 14, 2025
@per1234 per1234 closed this May 14, 2025
Copy link
Contributor Author

dependabot bot commented on behalf of github May 14, 2025

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version. You can also ignore all major, minor, or patch releases for a dependency by adding an ignore condition with the desired update_types to your config file.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.

@dependabot dependabot bot deleted the dependabot/go_modules/github.com/olekukonko/tablewriter-1.0.4 branch May 14, 2025 03:33
@per1234 per1234 added the conclusion: declined Will not be worked on label May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: declined Will not be worked on topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant