Bug Report: Compilation Error - Missing Methods in tablewriter.Table

#286 · open · 3 comments

View on GitHub ↗

rymiyamoto

## Description The `sql-migrate` package fails to compile due to missing methods (`SetHeader` and `SetColWidth`) in the `tablewriter.Table` type. ## Environment - **Go version**: go version go1.24.4 linux/arm64 - **Operating system**: Linux (e.g., Ubuntu 22.04) - **sql-migrate version**: v1.8.0 ## Error Message ``` $ go tool github.com/rubenv/sql-migrate/sql-migrate up -config dbconf.yml /go/pkg/mod/github.com/rubenv/[email protected]/sql-migrate/command_status.go:74:8: table.SetHeader undefined (type tablewriter.Table has no field or method SetHeader) /go/pkg/mod/github.com/rubenv/[email protected]/sql-migrate/command_status.go:75:8: table.SetColWidth undefined (type tablewriter.Table has no field or method SetColWidth) ``` ## Steps to Reproduce 1. Import or use `github.com/rubenv/[email protected]` 2. Run the following command in the terminal: ```sh $ go tool github.com/rubenv/sql-migrate/sql-migrate up -config dbconf.yml ``` ## Expected Behavior The package should compile successfully without any undefined method errors. ## Attempted Solutions - Ran `go mod tidy` - Cleared module cache with `go clean -modcache` - Updated dependencies with `go get -u ./...` - Tried rebuilding with `go clean -cache && go build` ## Additional Context This appears to be a dependency version mismatch issue between `sql-migrate` and the `github.com/olekukonko/tablewriter` package. The methods `SetHeader` and `SetColWidth` seem to be missing or have been renamed in the current version of tablewriter. ## Possible Fix The issue might be resolved by: 1. Updating the tablewriter dependency to a compatible version 2. Or updating the method calls to use the correct API from the current tablewriter version ## Related Files - https://github.com/rubenv/sql-migrate/blob/v1.8.0/sql-migrate/command_status.go#L74-L75

Comments

rymiyamoto

## Update / Workaround I can confirm that installing the `@latest` version works without any issues. This suggests the bug has already been fixed on the `main` branch. The following command runs successfully: ```sh $ go install github.com/rubenv/sql-migrate/...@latest $ sql-migrate up -config dbconf.yml ```

eklatzer

As described in https://github.com/olekukonko/tablewriter/issues/270 a workaround is to pin tablewriter to a legacy version: ``` go get github.com/olekukonko/[email protected] ```

rymiyamoto

@eklatzer Thank you for the workaround suggestion, I tried it and it worked fine 🎉