From 6f0b883dfee61859e36a5c016680d2ddeac25f1f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Aug 2026 14:00:57 +0000 Subject: [PATCH 1/2] chore(deps): bump github.com/olekukonko/tablewriter from 0.0.5 to 1.1.4 Bumps [github.com/olekukonko/tablewriter](https://github.com/olekukonko/tablewriter) from 0.0.5 to 1.1.4. - [Release notes](https://github.com/olekukonko/tablewriter/releases) - [Commits](https://github.com/olekukonko/tablewriter/compare/v0.0.5...v1.1.4) --- updated-dependencies: - dependency-name: github.com/olekukonko/tablewriter dependency-version: 1.1.4 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- go.mod | 14 +++++++++++--- go.sum | 30 +++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 93caae8..8bbe85d 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/fil-forge/ucantone v0.0.0-20260706102443-79141c5cc52e github.com/ipfs/go-cid v0.6.2 github.com/multiformats/go-multicodec v0.10.0 - github.com/olekukonko/tablewriter v0.0.5 + github.com/olekukonko/tablewriter v1.1.4 github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.12.1 github.com/whyrusleeping/cbor-gen v0.3.1 @@ -16,11 +16,17 @@ require ( ) require ( + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/clipperhouse/displaywidth v0.10.0 // indirect + github.com/clipperhouse/uax29/v2 v2.6.0 // indirect github.com/dlclark/regexp2/v2 v2.2.1 // indirect + github.com/fatih/color v1.18.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect - github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.19 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mr-tron/base58 v1.3.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect @@ -28,7 +34,9 @@ require ( github.com/multiformats/go-multibase v0.3.0 // indirect github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-varint v0.1.0 // indirect - github.com/rivo/uniseg v0.2.0 // indirect + github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect + github.com/olekukonko/errors v1.2.0 // indirect + github.com/olekukonko/ll v0.1.6 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/pflag v1.0.9 // indirect gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect diff --git a/go.sum b/go.sum index bf2607f..1ea9eb7 100644 --- a/go.sum +++ b/go.sum @@ -6,9 +6,17 @@ github.com/alecthomas/chroma/v2 v2.27.0 h1:FodwmyOBgJULFYmDqibcp9pvfDLWdtPRh9v/r github.com/alecthomas/chroma/v2 v2.27.0/go.mod h1:NjJ3ciIgrqBNeIkWZ4e46nseoLDslxU1LmfCoL+wcY8= github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs= github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clipperhouse/displaywidth v0.10.0 h1:GhBG8WuerxjFQQYeuZAeVTuyxuX+UraiZGD4HJQ3Y8g= +github.com/clipperhouse/displaywidth v0.10.0/go.mod h1:XqJajYsaiEwkxOj4bowCTMcT1SgvHo9flfF3jQasdbs= +github.com/clipperhouse/uax29/v2 v2.6.0 h1:z0cDbUV+aPASdFb2/ndFnS9ts/WNXgTNNGFoKXuhpos= +github.com/clipperhouse/uax29/v2 v2.6.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/dlclark/regexp2/v2 v2.2.1 h1:mf4KkFUj0gJuarK8P+LgiS+Lit7m9N1yAwEfPbee7R0= github.com/dlclark/regexp2/v2 v2.2.1/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/fil-forge/ucantone v0.0.0-20260706102443-79141c5cc52e h1:di/SseJVEO6bznSH/UEnAE2nSwwp/gqgnPLgE9/x2Zg= github.com/fil-forge/ucantone v0.0.0-20260706102443-79141c5cc52e/go.mod h1:oFY5BfD0bDeodGlbBHh3/nK99MAS93rGXjoQz7s5qgE= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= @@ -23,9 +31,12 @@ github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzh github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= -github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw= +github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mr-tron/base58 v1.3.0 h1:K6Y13R2h+dku0wOqKtecgRnBUBPrZzLZy5aIj8lCcJI= @@ -42,10 +53,14 @@ github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7B github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= github.com/multiformats/go-varint v0.1.0 h1:i2wqFp4sdl3IcIxfAonHQV9qU5OsZ4Ts9IOoETFs5dI= github.com/multiformats/go-varint v0.1.0/go.mod h1:5KVAVXegtfmNQQm/lCY+ATvDzvJJhSkUlGQV9wgObdI= -github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 h1:zrbMGy9YXpIeTnGj4EljqMiZsIcE09mmF8XsD5AYOJc= +github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6/go.mod h1:rEKTHC9roVVicUIfZK7DYrdIoM0EOr8mK1Hj5s3JjH0= +github.com/olekukonko/errors v1.2.0 h1:10Zcn4GeV59t/EGqJc8fUjtFT/FuUh5bTMzZ1XwmCRo= +github.com/olekukonko/errors v1.2.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= +github.com/olekukonko/ll v0.1.6 h1:lGVTHO+Qc4Qm+fce/2h2m5y9LvqaW+DCN7xW9hsU3uA= +github.com/olekukonko/ll v0.1.6/go.mod h1:NVUmjBb/aCtUpjKk75BhWrOlARz3dqsM+OtszpY4o88= +github.com/olekukonko/tablewriter v1.1.4 h1:ORUMI3dXbMnRlRggJX3+q7OzQFDdvgbN9nVWj1drm6I= +github.com/olekukonko/tablewriter v1.1.4/go.mod h1:+kedxuyTtgoZLwif3P1Em4hARJs+mVnzKxmsCL/C5RY= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -66,6 +81,7 @@ go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.53.0 h1:QZ4Muo8THX6CizN2vPPd5fBGHyogrdK9fG4wLPFUsto= golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= From c18f7ee7d8dd35398c56a5f93c437fa5807e90c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Fri, 21 Aug 2026 16:38:27 +0200 Subject: [PATCH 2/2] fix: migrate ucanfmt tables to tablewriter v1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tablewriter v1 replaced the SetXxx setters with a configuration-driven API, so the bump from 0.0.5 to 1.1.4 broke the build. All three formatters configured their table identically, so the setup now lives in one helper alongside a render call that panics on failure, matching how the formatters already handle unmarshal errors. Rendered tables keep their ASCII borders, row separators, left-aligned cells and disabled wrapping. v1 additionally trims trailing blank lines from multi-line cells, which drops two stray rows from the container's Contents cell. Assisted-by: Claude:claude-opus-5 Signed-off-by: Miroslav Bajtoš --- pkg/ucanfmt/container.go | 21 ++++----------------- pkg/ucanfmt/delegation.go | 11 ++--------- pkg/ucanfmt/invocation.go | 11 ++--------- pkg/ucanfmt/table.go | 31 +++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 35 deletions(-) create mode 100644 pkg/ucanfmt/table.go diff --git a/pkg/ucanfmt/container.go b/pkg/ucanfmt/container.go index 394549c..7d40e78 100644 --- a/pkg/ucanfmt/container.go +++ b/pkg/ucanfmt/container.go @@ -8,19 +8,12 @@ import ( "github.com/fil-forge/ucantone/ucan/container" cdm "github.com/fil-forge/ucantone/ucan/container/datamodel" "github.com/ipfs/go-cid" - "github.com/olekukonko/tablewriter" ) func FormatContainerAsTable(link cid.Cid, codec byte, model *cdm.ContainerModel) string { tableString := &strings.Builder{} - table := tablewriter.NewWriter(tableString) - table.SetHeader([]string{"Property", "Value"}) - table.SetAutoWrapText(false) - table.SetAutoMergeCells(false) - table.SetRowLine(true) - table.SetColumnAlignment([]int{tablewriter.ALIGN_LEFT, tablewriter.ALIGN_LEFT}) - table.SetColWidth(120) + table := newTable(tableString, "Property", "Value") table.Append([]string{"/", link.String()}) table.Append([]string{"Codec", fmt.Sprintf("0x%02x (%s)", codec, container.FormatCodec(codec))}) @@ -34,18 +27,12 @@ func FormatContainerAsTable(link cid.Cid, codec byte, model *cdm.ContainerModel) // table.Append([]string{"Data", strings.Join(data, "\n")}) dataTableString := &strings.Builder{} - dataTableWriter := tablewriter.NewWriter(dataTableString) - dataTableWriter.SetHeader([]string{"#", "Bytes"}) - dataTableWriter.SetAutoWrapText(false) - dataTableWriter.SetAutoMergeCells(false) - dataTableWriter.SetRowLine(true) - dataTableWriter.SetColumnAlignment([]int{tablewriter.ALIGN_LEFT, tablewriter.ALIGN_LEFT}) - dataTableWriter.SetColWidth(120) + dataTableWriter := newTable(dataTableString, "#", "Bytes") for i, v := range model.Ctn1 { dataTableWriter.Append([]string{fmt.Sprintf("%d ", i), hex.Dump(v)}) } - dataTableWriter.Render() + renderTable(dataTableWriter) table.Append([]string{"Contents", dataTableString.String()}) - table.Render() + renderTable(table) return tableString.String() } diff --git a/pkg/ucanfmt/delegation.go b/pkg/ucanfmt/delegation.go index ab4ecca..d7cd341 100644 --- a/pkg/ucanfmt/delegation.go +++ b/pkg/ucanfmt/delegation.go @@ -11,19 +11,12 @@ import ( ddm "github.com/fil-forge/ucantone/ucan/delegation/datamodel" "github.com/fil-forge/ucantool/pkg/ipldfmt" "github.com/ipfs/go-cid" - "github.com/olekukonko/tablewriter" ) func FormatDelegationAsTable(link cid.Cid, dlg ucan.Delegation) string { tableString := &strings.Builder{} - table := tablewriter.NewWriter(tableString) - table.SetHeader([]string{"Property", "Value"}) - table.SetAutoWrapText(false) - table.SetAutoMergeCells(false) - table.SetRowLine(true) - table.SetColumnAlignment([]int{tablewriter.ALIGN_LEFT, tablewriter.ALIGN_LEFT}) - table.SetColWidth(120) + table := newTable(tableString, "Property", "Value") table.Append([]string{"/", link.String()}) table.Append([]string{"Tag", ddm.Tag}) @@ -55,6 +48,6 @@ func FormatDelegationAsTable(link cid.Cid, dlg ucan.Delegation) string { table.Append([]string{"Signature", ipldfmt.FormatDagJsonBytesMaxLen(dlg.Signature().Bytes(), 80)}) table.Append([]string{"Nonce", ipldfmt.FormatDagJsonBytesMaxLen(dlg.Nonce(), 80)}) - table.Render() + renderTable(table) return tableString.String() } diff --git a/pkg/ucanfmt/invocation.go b/pkg/ucanfmt/invocation.go index 9c614fb..2f4af88 100644 --- a/pkg/ucanfmt/invocation.go +++ b/pkg/ucanfmt/invocation.go @@ -11,19 +11,12 @@ import ( idm "github.com/fil-forge/ucantone/ucan/invocation/datamodel" "github.com/fil-forge/ucantool/pkg/ipldfmt" "github.com/ipfs/go-cid" - "github.com/olekukonko/tablewriter" ) func FormatInvocationAsTable(link cid.Cid, inv ucan.Invocation) string { tableString := &strings.Builder{} - table := tablewriter.NewWriter(tableString) - table.SetHeader([]string{"Property", "Value"}) - table.SetAutoWrapText(false) - table.SetAutoMergeCells(false) - table.SetRowLine(true) - table.SetColumnAlignment([]int{tablewriter.ALIGN_LEFT, tablewriter.ALIGN_LEFT}) - table.SetColWidth(120) + table := newTable(tableString, "Property", "Value") table.Append([]string{"/", link.String()}) table.Append([]string{"Tag", idm.Tag}) @@ -74,6 +67,6 @@ func FormatInvocationAsTable(link cid.Cid, inv ucan.Invocation) string { table.Append([]string{"Signature", ipldfmt.FormatDagJsonBytesMaxLen(inv.Signature().Bytes(), 80)}) table.Append([]string{"Nonce", ipldfmt.FormatDagJsonBytesMaxLen(inv.Nonce(), 80)}) - table.Render() + renderTable(table) return tableString.String() } diff --git a/pkg/ucanfmt/table.go b/pkg/ucanfmt/table.go new file mode 100644 index 0000000..1c2f656 --- /dev/null +++ b/pkg/ucanfmt/table.go @@ -0,0 +1,31 @@ +package ucanfmt + +import ( + "fmt" + "io" + + "github.com/olekukonko/tablewriter" + "github.com/olekukonko/tablewriter/tw" +) + +// newTable creates the two-column layout shared by all formatters in this +// package: ASCII borders, a line between every row and no wrapping, so +// multi-line values such as hex dumps and DAG-JSON stay intact. +func newTable(w io.Writer, header ...string) *tablewriter.Table { + table := tablewriter.NewTable(w, + tablewriter.WithRendition(tw.Rendition{ + Symbols: tw.NewSymbols(tw.StyleASCII), + Settings: tw.Settings{Separators: tw.Separators{BetweenRows: tw.On}}, + }), + tablewriter.WithRowAutoWrap(tw.WrapNone), + tablewriter.WithRowAlignment(tw.AlignLeft), + ) + table.Header(header) + return table +} + +func renderTable(table *tablewriter.Table) { + if err := table.Render(); err != nil { + panic(fmt.Errorf("rendering table: %w", err)) + } +}