Visitar URL original
go: show EOF error on last line · Issue #2447 · neomake/neomake · GitHub
Skip to content

go: show EOF error on last line #2447

Open

Description

@sbromberger

When the following program is tested:

package main

import "fmt"

func main() {
  a := 1
  b := 2
  if a + b > 6 {
    fmt.Println(a + b)  // note - no closing brace here
}                       // this is the last line of the file

The error produced, go: syntax error: unexpected EOF, expecting } (E) is beyond the last line of the file and therefore doesn't appear (in the gutter or on a hover).

When a blank line follows the last closing brace, the error appears on that line, but only until the file is saved.

Expected behavior

It would be nice if any errors that were attributed to nonexistent line numbers were associated with the last line of the program.

Steps to reproduce

See above. Use the standard go maker.

Output from :NeomakeInfo

Neomake debug information

Async support: 1
Current filetype: go
Windows: 0
[shell, shellcmdflag, shellslash]: ['/bin/bash', '-c', 0]
makeprg=make

Enabled makers

For the current filetype ("go", used with :Neomake):

  • go
    • append_file: 0

    • args: ['test', '-c', '-o', '/dev/null']

    • auto_enabled: 1

    • cwd: '%:h'

    • errorformat: '%W%f:%l: warning: %m,%E%f:%l:%c:%m,%E%f:%l:%m,%C%\s%+%m,%-G%.%#\[no test files],%-G#%.%#'

    • exe: 'go'

    • postprocess: function('neomake#postprocess#compress_whitespace')

    • serialize: 1

    • serialize_abort_on_error: 1

    • version_arg: 'version'

    • version information (/home/seth/.local/go/bin/go version): go version go1.13.5 linux/amd64

  • golangci_lint
    • append_file: 0
    • args: ['run', '--out-format=line-number', '--print-issued-lines=false', '--enable', 'golint']
    • auto_enabled: 1
    • cwd: '%:h'
    • errorformat: '%f:%l:%c: %m,%f:%l: %m'
    • exe: 'golangci-lint'
    • output_stream: 'stdout'
    • version information (/home/seth/dev/go/bin/golangci-lint --version): golangci-lint has version 1.21.0 built from 645e794 on 2019-10-15T1
      8:16:56Z
      NOTE: you can define g:neomake_go_enabled_makers to configure it (or b:neomake_go_enabled_makers).
      For the project (used with :Neomake!):
  • makeprg
    • append_file: 0
    • args: []
    • auto_enabled: 1
    • errorformat: '%[^"]"%f"%\D%l: %m,"%f"%\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each functio
      n it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c,,%-GIn file included from %f:%l:%c,%-GIn file include
      d from %f:%l,%-G%
      [ ]from %f:%l:%c,%-G%[ ]from %f:%l:,%-G%[ ]from %f:%l,,%-G%[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f", line %l%
      \D%c%[^ ] %m,%D%
      \a[%\d]: Entering directory %['']%f'',%X%*\a[%*\d]: Leaving directory %*['']%f'',%D%\a: Entering directory %[`'']%f'

mode
',%X%\a: Leaving directory %[`'']%f'',%DMaking %*\a in %f,%f|%l| %m'

  • exe: 'make'
  • version information (/usr/bin/make --version): GNU Make 4.2.1
    Built for x86_64-pc-linux-gnu
    Copyright (C) 1988-2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    NOTE: you can define g:neomake_enabled_makers to configure it.
    Default maker settings:
  • output_stream: 'both'
  • remove_invalid_entries: 0
  • buffer_output: 1
Settings
New-style (dict, overrides old-style)
g:neomake: {
  'automake': {

    'ignore_filetypes': [
      'startify',
    ],
    'events': {
      'BufWritePost': {
        'delay': 0,
      },
      'FileChangedShellPost': {},
      'FileType': {},
      'BufWinEnter': {},
      'InsertLeave': {},
      'TextChanged': {},
    },
  },
  'automake_delay': 750,
}
b:neomake: unset
Old-style

g:neomake_error_sign = {'texthl': 'NeomakeErrorSign', 'text': '✖'}
g:neomake_go_golangci_lint_args = ['run', '--out-format=line-number', '--print-issued-lines=false', '--enable', 'golint']
g:neomake_info_sign = {'texthl': 'NeomakeInfoSign', 'text': 'i'}
g:neomake_logfile = '/tmp/neomake.log'
g:neomake_message_sign = {'texthl': 'NeomakeMessageSign', 'text': '➤'}
g:neomake_place_signs = 1
g:neomake_warning_sign = {'texthl': 'NeomakeWarningSign', 'text': '‼'}

:version

NVIM v0.5.0-291-g0c436559d
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototype
s -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DIN
CLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/seth/build/neovim/b
uild/config -I/home/seth/build/neovim/src -I/home/seth/build/neovim/.deps/usr/include -I/usr/include -I/home/seth/build/neovim/build/src/nvim
/auto -I/home/seth/build/neovim/build/include

LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototype
s -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DIN
CLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/seth/build/neovim/b
uild/config -I/home/seth/build/neovim/src -I/home/seth/build/neovim/.deps/usr/include -I/usr/include -I/home/seth/build/neovim/build/src/nvim
/auto -I/home/seth/build/neovim/build/include
Compiled by seth@hydrogen
Features: +acl +iconv +tui
See ":help feature-compile"
   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/home/seth/.local/share/nvim"
Run :checkhealth for more info

:messages

"main.go" [New] 10L, 135C written

Activity

  1. blueyed commented on Jan 3, 2020

    @blueyed
    Member

    It would be nice if any errors that were attributed to nonexistent line numbers were associated with the last line of the program.

    Makes sense.
    Except for < 1, which should be attributed to line 1 then probably.

    The error produced, go: syntax error: unexpected EOF, expecting } (E)

    What's the raw output here? Does it have a line number after all?

  2. sbromberger commented on Jan 3, 2020

    @sbromberger
    Author

    Does this help?

    11:49:30 2046 [V      ] [2.2:1:1] Starting async job: go test -c -o /dev/null.
    11:49:30 2046 [D      ] [2.2:1:1] cwd: /home/seth/dev/go/src/github.com/sbromberger/vt1.
    11:49:30 2046 [D      ] [-.-:1:1] automake: started jobs: [2].
    11:49:30 2046 [D +0.07] [2.2:1:1] output on stderr: ['# github.com/sbromberger/vt1', '../../src/github.com/sbromberger/vt1/main.go:13:1: synt
    ax error: unexpected EOF, expecting }', ''].
    11:49:30 2046 [D      ] [2.2:1:1] exit: go: 2.
    11:49:30 2046 [D      ] [2.2:1:1] Processing 2 lines of output.
    11:49:30 2046 [D      ] [-.-:1:1] Using setting cwd='%:h' from 'maker'.
    11:49:30 2046 [D      ] [-.-:1:1] Using setting cwd='%:h' from 'maker'.
    11:49:30 2046 [D      ] [-.-:1:1] Using setting postprocess=function('neomake#postprocess#compress_whitespace') from 'maker'.
    11:49:30 2046 [D      ] [2.2:1:1] Modified list entry 1 (postprocess): {'changed': {'text': [' syntax error: unexpected EOF, expecting }', 's
    yntax error: unexpected EOF, expecting }']}}.
    11:49:30 2046 [D      ] WARN: seen entries with bufnr different from jobinfo.bufnr (1): {'2': 1}, current bufnr: 1.
    11:49:30 2046 [D      ] [2.-:1:1] Adding 1 list entries.
    11:49:30 2046 [D      ] [2.-:1:1] Reusing location list for entries.
    11:49:30 2046 [D      ] list: call: set: [0, [], 'r', {'context': {'neomake': {'make_info': 'make_id=2'}}, 'items': [{'lnum': 13, 'bufnr': 2,
     'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'E', 'pattern': '', 'text': 'syntax error: unexpected EOF, expecting }'}], 
    'title': 'Neomake[auto]: main.go (go..., golangci_lint?)'}].
    11:49:30 2046 [D      ] list: got qfid (action=set): 2.
    
  3. blueyed commented on Jan 3, 2020

    @blueyed
    Member

    Yes, thanks.

    11:49:30 2046 [D +0.07] [2.2:1:1] output on stderr: ['# github.com/sbromberger/vt1', '../../src/github.com/sbromberger/vt1/main.go:13:1: syntax error: unexpected EOF, expecting }', ''].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions