Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

go checker fails - go build -o /dev/null because /dev/null exists & isn't an object file #1436

Closed
phobologic opened this issue Jun 3, 2015 · 7 comments

Comments

@phobologic
Copy link

When using Syntastic w/ go, I get the following errors when it hits the go build step:

go install github.com/phobologic/example: build output "/dev/null" already exists and is not an object file

This is using go version go1.4.2 darwin/amd64

Vim Version:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 31 2015 12:46:29)
MacOS X (unix) version
Included patches: 1-712

Syntastic Version:

Syntastic version: 3.6.0-86 (Vim 704, Darwin)
Info for filetype: go
Global mode: active
Filetype go is active
syntastic: 18.661908: &shell = '/bin/bash', &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1', &shellslash = 0, &shelltemp = 1, &shellx
quote = '', &shellxescape = ''
syntastic: 18.662178: UpdateErrors: default checkers
syntastic: 18.662453: CacheErrors: default checkers
syntastic: 18.662965: g:syntastic_aggregate_errors = 0
syntastic: 18.663121: getcwd() = '/Users/mike/go/src/github.com/phobologic/example'
syntastic: 18.663408: CacheErrors: Invoking checker: go/go
syntastic: 18.663899: SyntasticMake: called with options: {'errorformat': '%f:%l:%c: %m,%-G%.%#', 'defaults': {'type': 'e'}, 'makeprg': 'gofmt -l pkg/lb/dns.go > /dev/null'}
syntastic: 18.686095: checker output: ['']
syntastic: 18.686392: raw loclist: []
syntastic: 18.686697: SyntasticMake: called with options: {'cwd': '/Users/mike/go/src/github.com/phobologic/example', 'errorformat': '%W%f:%l: warning: %m,%E%f:%l:%c:%m,%E%f:%l:%m,%C%\s%\+%m,%-G#%.%#', 'defaults': {'type': 'e'}, 'makeprg': 'go build  -o /dev/null'}
syntastic: 19.240862: checker output: ['go install github.com/phobologic/example: build output "/dev/null" already exists and is not an object file', '']
syntastic: 19.241312: raw loclist: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'go install github.com/phobologic/example: build output "/dev/null" already exists and is not an object file'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ''}]
syntastic: 19.241589: getLocList: checker go/go returned 1
syntastic: 19.241706: go/go raw: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': 'e', 'pattern': '', 'text': 'go install github.com/phobologic/example: build output "/dev/null" already exists and is not an object file'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': 'e', 'pattern':
'', 'text': ''}]
syntastic: 19.241906: quiet_messages filter: {}
syntastic: 19.242160: aggregated: {'_sorted': 0, '_name': '', '_owner': 3, '_columns': 1, '_rawLoclist': []}
@phobologic
Copy link
Author

BTW, I found this which might shed some light on the issue:

flycheck/flycheck#465

@lcd047
Copy link
Collaborator

lcd047 commented Jun 3, 2015

This has to be the most asinine error condition I saw in a very long time. :) Apparently it has been known for >2 years, and it isn't going to be solved:

http://code.google.com/p/go/issues/detail?id=4851
golang/go#4851

Since you're going to run go build eventually anyway, and since go doesn't have any other syntax checking mode, I'll just allow it to do its thing and generate object files. Set g:syntastic_go_go_build_args and g:syntastic_go_go_test_args to redirect the output somewhere else if that bothers you. Sorry about that. Commit e15ebd3.

@lcd047 lcd047 closed this as completed Jun 3, 2015
@phobologic
Copy link
Author

Yeah, I saw that too in my search for a solution - sometimes the go community can be ... anyway - thanks for fixing this! :)

@jephir
Copy link

jephir commented Jun 3, 2015

In case anyone else is running into the issue where Syntastic is creating binary files in their source directory after e15ebd3, you can solve it by putting let g:syntastic_go_go_build_args = "-o /dev/null" in your .vimrc as stated above.

@lcd047
Copy link
Collaborator

lcd047 commented Jun 3, 2015

@jephir Yes, that restores the previous behaviour. It also restores the problem reported in the initial post of this thread. Your choice. shrug

@phobologic
Copy link
Author

I was actually wondering if that'd end up being a problem. I haven't had a chance to test it out yet - but provided it is a problem (it seems like it could get messy with git, etc) would my patch be a decent middle ground? ie: using a temp directory that is cleaned up afterwards?

@lcd047
Copy link
Collaborator

lcd047 commented Jun 3, 2015

@phobologic I'm reluctant to do that for a very simple reason: syntastic#util#rmrf() is a disaster waiting to happen. Yes, syntastic is taking all precautions I could think of to make it safe. I'd still like to avoid it if at all possible.

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

Successfully merging a pull request may close this issue.

3 participants