Skip to content

Commit

Permalink
Merge pull request #6 from noborus/lint-refactor
Browse files Browse the repository at this point in the history
Fixed the issue using lint
  • Loading branch information
noborus authored Jun 18, 2024
2 parents d074cec + a299c9e commit c9581d8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cmd/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/spf13/cobra"
)

// csvCmd represents the csv command
// csvCmd represents the csv command.
var csvCmd = &cobra.Command{
Use: "csv",
Short: "Output in csv format",
Expand Down
3 changes: 1 addition & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/spf13/cobra"
)

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

// initConfig reads in config file and ENV variables if set.
func initConfig() {

}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module github.com/noborus/guesswidth
go 1.18

require (
github.com/mattn/go-runewidth v0.0.14
github.com/mattn/go-runewidth v0.0.15
github.com/spf13/cobra v1.6.1
)

require (
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
Expand Down
8 changes: 4 additions & 4 deletions guesswidth.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func split(line string, pos []int, trimSpace bool) []string {
if trimSpace {
columns[n] = strings.TrimSpace(col)
} else {
columns[n] = string(col)
columns[n] = col
}
n++
start = end
Expand All @@ -217,7 +217,7 @@ func split(line string, pos []int, trimSpace bool) []string {
if trimSpace {
columns[n] = strings.TrimSpace(col)
} else {
columns[n] = string(col)
columns[n] = col
}
}
return columns
Expand Down Expand Up @@ -268,9 +268,9 @@ func countBlanks(blanks []int, line string) []int {
blanks[n] += 1
}

n += 1
n++
if runewidth.RuneWidth(r) == 2 {
n += 1
n++
}
}
return blanks
Expand Down

0 comments on commit c9581d8

Please sign in to comment.