mithrandie / csvq

SQL-like query language for csv
https://mithrandie.github.io/csvq
MIT License
1.52k stars 64 forks source link

Return false for empty string #4

Closed mattn closed 5 years ago

mattn commented 5 years ago

If there are environment variables which have empty value, csvq panic.

csvq interactive shell
Press Ctrl+D or execute "EXIT;" to terminate this shell.

[snip]
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/mithrandie/csvq/lib/cmd.MustBeEnclosed(0xc0001200e0, 0x0, 0xc000086ff0)
    c:/dev/godev/src/github.com/mithrandie/csvq/lib/cmd/utils.go:204 +0x256
github.com/mithrandie/csvq/lib/cmd.EnvironmentVariableSymbol(0xc0001200e0, 0x0, 0x7c4a96, 0x1)
    c:/dev/godev/src/github.com/mithrandie/csvq/lib/cmd/utils.go:191 +0x43
github.com/mithrandie/csvq/lib/query.(*Completer).updateEnvironmentVariables(0xc0000fc000)
    c:/dev/godev/src/github.com/mithrandie/csvq/lib/query/completer_readline.go:268 +0x1bb
github.com/mithrandie/csvq/lib/query.(*Completer).Update(0xc0000fc000)
    c:/dev/godev/src/github.com/mithrandie/csvq/lib/query/completer_readline.go:183 +0x7d
github.com/mithrandie/csvq/lib/query.ReadLineTerminal.UpdateCompleter(...)
    c:/dev/godev/src/github.com/mithrandie/csvq/lib/query/terminal_readline.go:122
github.com/mithrandie/csvq/lib/action.LaunchInteractiveShell(0xc00008fad0, 0x0, 0x0)
    c:/dev/godev/src/github.com/mithrandie/csvq/lib/action/run.go:106 +0x1bd
main.main.func9(0xc0000b6160, 0x0, 0x0)
    c:/dev/godev/src/github.com/mithrandie/csvq/main.go:258 +0x98
github.com/urfave/cli.HandleAction(0x755060, 0xc0000566f0, 0xc0000b6160, 0xc0000b2600, 0x0)
    c:/dev/godev/src/github.com/urfave/cli/app.go:501 +0xcf
github.com/urfave/cli.(*App).Run(0xc0000ce000, 0xc000056170, 0x1, 0x1, 0x0, 0x0)
    c:/dev/godev/src/github.com/urfave/cli/app.go:268 +0x59d
main.main()
    c:/dev/godev/src/github.com/mithrandie/csvq/main.go:276 +0x149a
codecov[bot] commented 5 years ago

Codecov Report

Merging #4 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #4      +/-   ##
==========================================
+ Coverage   92.46%   92.46%   +<.01%     
==========================================
  Files          70       70              
  Lines       13408    13410       +2     
==========================================
+ Hits        12398    12400       +2     
  Misses        852      852              
  Partials      158      158
Impacted Files Coverage Δ
lib/cmd/utils.go 97.12% <100%> (+0.02%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 945ae48...f63fdc0. Read the comment docs.

mithrandie commented 5 years ago

This request is merged and released as version 1.8.2. Thanks.