Skip to content

Run revive over a project with an invalid go source file #364

Closed
@josemiguelmelo

Description

@josemiguelmelo

Hello,

Describe the bug
When you run Revive on a project that has an invalid go source file, it fails because it can't read the AST.

To Reproduce
Steps to reproduce the behavior:

  1. Create an invalid go source file, such as:
package main

import "fmt"

func example() {
	ok := 1
	if ok == 1 {
		fmt.Print("OK")
	
}
  1. I run it with the following flags & no configuration file:
revive -formatter json

Expected behavior
Instead of failing the entire analysis, Revive could add the AST parsing error to the revive failures list and output it at the end along with other failures.

Logs

Current output:

example.go:10:3: expected '}', found 'EOF'

with exit status 1

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions