PaesslerAG / gval

Expression evaluation in golang
BSD 3-Clause "New" or "Revised" License
731 stars 82 forks source link

A few code cleanups as suggested by staticcheck #57

Closed Jacalz closed 3 years ago

Jacalz commented 3 years ago

This commits adds in a few suggestions that I got from staticcheck. I also cleaned up a bit further in some cases. Below are the report from staticcheck:

/home/jacob/Downloads/gval/evaluable.go
  (300, 25)  SA1012  do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use
  (332, 25)  SA1012  do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use

/home/jacob/Downloads/gval/language.go
  (258, 2)  SA6003  should range over string, not []rune(string)

/home/jacob/Downloads/gval/operator.go
  (107, 2)  S1023  redundant return statement

/home/jacob/Downloads/gval/parse.go
  (123, 3)  S1005  unnecessary assignment to the blank identifier

/home/jacob/Downloads/gval/parser.go
  (22, 46)  S1023  redundant return statement
  (84, 2)   S1023  redundant return statement

/home/jacob/Downloads/gval/random_test.go
  (16, 2)   U1000  var empty3 is unused
  (105, 2)  U1000  var panics is unused
generikvault commented 3 years ago

thx