Skip to content

Commit c9581d8

Browse files
authored
Merge pull request #6 from noborus/lint-refactor
Fixed the issue using lint
2 parents d074cec + a299c9e commit c9581d8

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

cmd/csv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/spf13/cobra"
1010
)
1111

12-
// csvCmd represents the csv command
12+
// csvCmd represents the csv command.
1313
var csvCmd = &cobra.Command{
1414
Use: "csv",
1515
Short: "Output in csv format",

cmd/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/spf13/cobra"
99
)
1010

11-
// rootCmd represents the base command when called without any subcommands
11+
// rootCmd represents the base command when called without any subcommands.
1212
var rootCmd = &cobra.Command{
1313
Use: "guesswidth",
1414
Short: "Guess the width of the column and split it",
@@ -71,5 +71,4 @@ func init() {
7171

7272
// initConfig reads in config file and ENV variables if set.
7373
func initConfig() {
74-
7574
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ module github.com/noborus/guesswidth
33
go 1.18
44

55
require (
6-
github.com/mattn/go-runewidth v0.0.14
6+
github.com/mattn/go-runewidth v0.0.15
77
github.com/spf13/cobra v1.6.1
88
)
99

1010
require (
1111
github.com/inconshreveable/mousetrap v1.0.1 // indirect
12-
github.com/rivo/uniseg v0.2.0 // indirect
12+
github.com/rivo/uniseg v0.4.7 // indirect
1313
github.com/spf13/pflag v1.0.5 // indirect
1414
)

go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
22
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
33
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
4-
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
5-
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
6-
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
4+
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
5+
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
76
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
7+
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
8+
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
89
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
910
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
1011
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=

guesswidth.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func split(line string, pos []int, trimSpace bool) []string {
205205
if trimSpace {
206206
columns[n] = strings.TrimSpace(col)
207207
} else {
208-
columns[n] = string(col)
208+
columns[n] = col
209209
}
210210
n++
211211
start = end
@@ -217,7 +217,7 @@ func split(line string, pos []int, trimSpace bool) []string {
217217
if trimSpace {
218218
columns[n] = strings.TrimSpace(col)
219219
} else {
220-
columns[n] = string(col)
220+
columns[n] = col
221221
}
222222
}
223223
return columns
@@ -268,9 +268,9 @@ func countBlanks(blanks []int, line string) []int {
268268
blanks[n] += 1
269269
}
270270

271-
n += 1
271+
n++
272272
if runewidth.RuneWidth(r) == 2 {
273-
n += 1
273+
n++
274274
}
275275
}
276276
return blanks

0 commit comments

Comments
 (0)