Skip to content

refact: bump tablewriter to v1, fix the breaking change #2024

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

Merged
merged 2 commits into from
Jun 2, 2025

Conversation

kemingy
Copy link
Member

@kemingy kemingy commented Jun 2, 2025

No description provided.

@kemingy kemingy requested a review from Copilot June 2, 2025 03:06
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the olekukonko/tablewriter dependency to v1 and replaces all direct tablewriter calls with a shared CreateTable factory to adapt to the new builder API.

  • Introduces CreateTable in formatter/table and switches existing renderers to use it
  • Removes repetitive table setup in various formatters (image_prune.go, image.go, env.go, context.go)
  • Bumps tablewriter (and several other modules) in go.mod

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/app/image_prune.go Switched from tablewriter.NewWriter to formatter/table.CreateTable
pkg/app/formatter/table/image.go Replaced inline tablewriter setup with CreateTable and Header
pkg/app/formatter/table/env.go Consolidated all table config into new CreateTable implementation
pkg/app/formatter/table/context.go Updated to use CreateTable instead of inline setup
go.mod Bumped olekukonko/tablewriter to v1.0.7 (and other indirect deps)
Comments suppressed due to low confidence (2)

pkg/app/formatter/table/env.go:91

  • Consider adding unit tests for CreateTable to ensure headers, row wrapping, and alignment behave as expected under the new v1 API, preventing regressions in table formatting.
func CreateTable(w io.Writer) *tablewriter.Table {

pkg/app/formatter/table/env.go:98

  • [nitpick] The new CreateTable disables borders for all tables (using tw.BorderNone), whereas the original createTable enabled borders for dependency and port-binding tables. If you rely on borders for clarity in those tables, consider exposing a border option or restoring the previous border setting for those cases.
Borders: tw.BorderNone,

Signed-off-by: Keming <[email protected]>
@kemingy kemingy requested a review from Copilot June 2, 2025 04:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR bumps the tablewriter dependency to v1 and updates the Docker error handling logic to fix breaking changes in the API. Key changes include replacing client.IsErrNotFound with errdefs.IsNotFound, refactoring table rendering functions to return errors, and updating dependency versions in go.mod.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/envd/docker.go Updated error checks to use errdefs.IsNotFound
pkg/driver/docker/docker.go Replaced client.IsErrNotFound with errdefs.IsNotFound in multiple methods
pkg/app/image_prune_test.go Modified test to capture error returned by renderPruneReport
pkg/app/image_prune.go Refactored renderPruneReport to return an error and use CreateTable
pkg/app/image_describe.go Updated table rendering to return errors for dependencies
pkg/app/image.go Updated table rendering to return errors instead of silently rendering
pkg/app/formatter/table/image.go Refactored RenderImages with error handling on table.Append and table.Render
pkg/app/formatter/table/env.go Updated environment table rendering functions to return errors
pkg/app/formatter/table/context.go Modified RenderContext to return error on failure during table.Append
pkg/app/env_ls.go Updated call to RenderEnvironments to return its error
pkg/app/env_describe.go Updated error handling in rendering dependencies and port bindings
pkg/app/context_ls.go Modified table rendering call for RenderContext to handle errors
go.mod Bumped multiple dependency versions including tablewriter and Docker

@kemingy kemingy merged commit b964594 into tensorchord:main Jun 2, 2025
11 checks passed
@kemingy kemingy deleted the tablewriter branch June 2, 2025 06:44
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.

1 participant