mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 02:14:13 +00:00
* Static-check fixes from @lespea #1657, batch 2/n * Static-check fixes from @lespea #1657, batch 3/n * Static-check fixes from @lespea #1657, batch 4/n * Static-check fixes from @lespea #1657, batch 5/n * Static-check fixes from @lespea #1657, batch 6/n
This commit is contained in:
parent
02bd5344b9
commit
b4ff26a7d0
5 changed files with 7 additions and 7 deletions
|
|
@ -394,7 +394,7 @@ func parseCommandLinePassTwo(
|
|||
options.FileNames = nil
|
||||
}
|
||||
|
||||
if options.DoInPlace && (options.FileNames == nil || len(options.FileNames) == 0) {
|
||||
if options.DoInPlace && len(options.FileNames) == 0 {
|
||||
fmt.Fprintf(os.Stderr, "%s: -I option (in-place operation) requires input files.\n", "mlr")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ func (node *ASTNode) printParexOneLineAux() {
|
|||
|
||||
// IsLeaf determines if an AST node is a leaf node.
|
||||
func (node *ASTNode) IsLeaf() bool {
|
||||
return node.Children == nil || len(node.Children) == 0
|
||||
return len(node.Children) == 0
|
||||
}
|
||||
|
||||
// ChildrenAreAllLeaves determines if an AST node's children are all leaf nodes.
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ func (root *RootNode) regexProtectPrePass(ast *dsl.AST) {
|
|||
|
||||
func (root *RootNode) regexProtectPrePassAux(astNode *dsl.ASTNode) {
|
||||
|
||||
if astNode.Children == nil || len(astNode.Children) == 0 {
|
||||
if len(astNode.Children) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ func ValidateAST(
|
|||
|
||||
// They can do mlr put '': there are simply zero statements.
|
||||
// But filter '' is an error.
|
||||
if ast.RootNode.Children == nil || len(ast.RootNode.Children) == 0 {
|
||||
if len(ast.RootNode.Children) == 0 {
|
||||
if dslInstanceType == DSLInstanceTypeFilter {
|
||||
return fmt.Errorf("mlr: filter statement must not be empty")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ func regexCompiledSubOrGsub(
|
|||
breakOnFirst bool,
|
||||
) string {
|
||||
matrix := regex.FindAllStringSubmatchIndex(input, -1)
|
||||
if matrix == nil || len(matrix) == 0 {
|
||||
if len(matrix) == 0 {
|
||||
return input
|
||||
}
|
||||
|
||||
|
|
@ -321,7 +321,7 @@ func RegexCompiledMatchWithMapResults(
|
|||
ends := make([]int, 0, 10)
|
||||
|
||||
matrix := regex.FindAllStringSubmatchIndex(input, -1)
|
||||
if matrix == nil || len(matrix) == 0 {
|
||||
if len(matrix) == 0 {
|
||||
return false, captures, starts, ends
|
||||
}
|
||||
|
||||
|
|
@ -407,7 +407,7 @@ func RegexCompiledMatchWithCaptures(
|
|||
regex *regexp.Regexp,
|
||||
) (bool, []string) {
|
||||
matrix := regex.FindAllStringSubmatchIndex(input, -1)
|
||||
if matrix == nil || len(matrix) == 0 {
|
||||
if len(matrix) == 0 {
|
||||
// Set all captures to ""
|
||||
return false, make([]string, 10)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue