Skip to content

Syntax errors are not reported #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alecthomas opened this issue May 26, 2018 · 1 comment
Closed

Syntax errors are not reported #12

alecthomas opened this issue May 26, 2018 · 1 comment

Comments

@alecthomas
Copy link
Contributor

eg.

[aat@cavern:~/Projects/kong]golangci-lint run --fast
Congrats! No issues were found.
[aat@cavern:~/Projects/kong]go build .
# github.com/alecthomas/kong
../../.go/src/github.com/alecthomas/kong/build.go:67:5: syntax error: unexpected ft at end of statement
../../.go/src/github.com/alecthomas/kong/build.go:69:5: syntax error: unexpected else at end of statement
../../.go/src/github.com/alecthomas/kong/build.go:72:2: syntax error: non-declaration statement outside function body
[aat@cavern:~/Projects/kong]git diff
diff --git a/build.go b/build.go
index 2eabbf9..7fa50cd 100644
--- a/build.go
+++ b/build.go
@@ -64,7 +64,7 @@ func buildNode(v reflect.Value, seenFlags map[string]bool) *Node {
                tag := parseTag(fv, ft.Tag.Get("kong"))

                // Nested structs are either commands or args.
-               if ft.Type.Kind() == reflect.Struct && (tag.Cmd || tag.Arg) {
+               i ft.Type.Kind() == reflect.Struct && (tag.Cmd || tag.Arg) {
                        buildChild(node, v, ft, fv, tag, name, seenFlags)
                } else {
                        buildField(node, v, ft, fv, tag, name, seenFlags)
@golangci
Copy link
Collaborator

@alecthomas thank you for reporting!
Fix is in linked pull request, now compilation errors are reported like usual issues with limit of 3 per file:

$ golangci-lint run ./pkg/testdata/with_issues/typecheck_many_issues.go
pkg/testdata/with_issues/typecheck_many_issues.go:4:2: undeclared name: typecheckNotExists1 (typecheck)
        typecheckNotExists1.F1() // ERROR "undeclared name: typecheckNotExists1"
        ^
pkg/testdata/with_issues/typecheck_many_issues.go:5:2: undeclared name: typecheckNotExists2 (typecheck)
        typecheckNotExists2.F2() // ERROR "undeclared name: typecheckNotExists2"
        ^
pkg/testdata/with_issues/typecheck_many_issues.go:6:2: undeclared name: typecheckNotExists3 (typecheck)
        typecheckNotExists3.F3() // ERROR "undeclared name: typecheckNotExists3"
        ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant