csvdiff icon indicating copy to clipboard operation
csvdiff copied to clipboard

Runtime Error: index out range

Open TekTimmy opened this issue 3 years ago • 0 comments

While comparing 2 CSV files I get the following runtime error:

panic: runtime error: index out of range [2] with length 0

goroutine 1 [running]:
github.com/aswinkarthik/csvdiff/pkg/digest.Positions.String(0xc0000b2380, 0xc, 0x10, 0x0, 0x0, 0x0, 0xc00000003b, 0xc004774b60, 0xd6)
        /home/travis/gopath/src/github.com/aswinkarthik/csvdiff/pkg/digest/positions.go:35 +0x332
github.com/aswinkarthik/csvdiff/cmd.(*Formatter).json(0xc00010bac0, 0xb1a638, 0x0, 0x0, 0xc005bc6000, 0x78fe, 0x8f55, 0xb1a638, 0x0, 0x0, ...)
        /home/travis/gopath/src/github.com/aswinkarthik/csvdiff/cmd/formatter.go:130 +0x4de
github.com/aswinkarthik/csvdiff/cmd.(*Formatter).Format(0xc00010bac0, 0xb1a638, 0x0, 0x0, 0xc005bc6000, 0x78fe, 0x8f55, 0xb1a638, 0x0, 0x0, ...)
        /home/travis/gopath/src/github.com/aswinkarthik/csvdiff/cmd/formatter.go:45 +0x1a5
github.com/aswinkarthik/csvdiff/cmd.runContext(0xc000104000, 0x884060, 0xc000010018, 0x884060, 0xc000010020, 0x0, 0x0)
        /home/travis/gopath/src/github.com/aswinkarthik/csvdiff/cmd/root.go:108 +0x4c5
github.com/aswinkarthik/csvdiff/cmd.glob..func2(0xaf89c0, 0xc0000b50e0, 0x2, 0xa, 0x0, 0x0)
        /home/travis/gopath/src/github.com/aswinkarthik/csvdiff/cmd/root.go:87 +0x283
github.com/spf13/cobra.(*Command).execute(0xaf89c0, 0xc0000120c0, 0xa, 0xa, 0xaf89c0, 0xc0000120c0)
        /home/travis/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:826 +0x460
github.com/spf13/cobra.(*Command).ExecuteC(0xaf89c0, 0xc00006eda0, 0xc00006bf20, 0x43cb8a)
        /home/travis/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
        /home/travis/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:864
github.com/aswinkarthik/csvdiff/cmd.Execute()
        /home/travis/gopath/src/github.com/aswinkarthik/csvdiff/cmd/root.go:115 +0x76
main.main()
        /home/travis/gopath/src/github.com/aswinkarthik/csvdiff/main.go:29 +0x59

When I change the primary key column the problem does not occur anymore. I'm sorry for not providing the CSVs but they contain sensitive data and are 24MB of size.

TekTimmy avatar Feb 09 '23 13:02 TekTimmy