Vim-go: E117: Unknown function: chansend

Created on 25 Sep 2018  路  18Comments  路  Source: fatih/vim-go

What did you do? (required. The issue will be closed when not provided.)

Browsed go code.

What did you expect to happen?

No errors.

What happened instead?

In a quickfix window:

Error detected while processing function <SNR>48_auto_type_info[3]..go#tool#Info[3]..go#complete#Info[2]..<SNR>104_async_info[58]..go#job#Start:                                                                           
line   41:
E117: Unknown function: chansend

Configuration (MUST fill this out):

  • vim-go version:
    master (5ec87ee2dd3443bb5d0c7f7331bec1d1ed60df9f)

  • Vim version (first three lines from :version):

NVIM v0.2.2
Build type: RelWithDebInfo
LuaJIT 2.0.4
  • Go version (go version):
    go version go1.11 linux/amd64

@ https://github.com/fatih/vim-go/blob/5ec87ee2dd3443bb5d0c7f7331bec1d1ed60df9f/autoload/go/job.vim#L305
The go#Job#Start function calls chansend and chanclose, which i believe are depreacated functions, I believe it should be jobsend and jobclose instead.

Most helpful comment

exists('*chansend') ? 'chansend' : 'jobsend'

There is no reason to do this, jobsend() continues to work on new versions. Just keep using jobsend() and jobclose() if the aim is so support older versions.

All 18 comments

I think you got it reversed: chansend() is the new name added in 0.3.0, and jobsend() the old one; based on this.

So try updating Neovim?

Reply from neovim dev team: https://github.com/neovim/neovim/issues/9051#issuecomment-424465302

I'm using the latest stable neovim version.

0.3.1 is the latest stable version, so you're a couple versions behind.

Hmm, interesting, it doesn't seem to have made its way into the neovim ubuntu ppa. Sorry for not checking that out.

Either way, from what I can tell from the neovim dev response, one should check if those functions exists before calling them.

Thanks, have a great day!

However, I don't see a reason (off-hand) why the plugin should require using chansend(). It would be better to handle a broader range of nvim versions. For example:

let s:chansend = exists('*chansend') ? 'chansend' : 'jobsend'
let s:chanclose = exists('*chanclose') ? 'chanclose' : 'jobclose'
...
    if len(l:input) > 0
      call call(s:chansend, [job, l:input])
      " close stdin to signal that no more bytes will be sent.
      call call(s:chanclose, [job, 'stdin'])
    endif

I agree, we should return an error. We already do it for several things. This is the second time an error is opened. I know we add the minimum version requirement to our README, but not many read it and it's easily skippable. We should let the user know that they need a never version of Nvim.

We should let the user know that they need a never version of Nvim.

Why is 0.3.1 required?

exists('*chansend') ? 'chansend' : 'jobsend'

There is no reason to do this, jobsend() continues to work on new versions. Just keep using jobsend() and jobclose() if the aim is so support older versions.

The aim is not to support older versions. Neovim is not making any guarantees about backward compatibility, and it's still pre-1.0.

Vim has v:version, but Neovim doesn't seem to update it correctly. Is there any easy way to get the version of Neovim besides parsing the output of :version?

v:version still means vim version, otherwise would break a lot of plugins. api_info().version is neovim version.

Neovim is not making any guarantees about backward compatibility

This isn't true. We've documented our compatibility requirements. There shouldn't be compatibility breaks from release to release (although APIs are subject to change during development cycles).

As @bfredl pointed out, the legacy names jobsend/jobclose have been kept explicitly to _avoid_ breaking code.

How long will they be kept?

We follow semantic versioning, so not until 1.x could we break an API.

Generally, pre-1.0 releases can break compatibility in semantic versioning. Can you point me to Neovim's documented api backward compatibility policy?

Thanks @jamessan ! I'll see if we have anything in vim-go now or (or coming up, because I'm working on some additional functionality) that requires 0.3.1.

We've merged #2000 for now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joeblubaugh picture joeblubaugh  路  3Comments

danielmanesku picture danielmanesku  路  4Comments

smontazeran picture smontazeran  路  4Comments

zhangjing picture zhangjing  路  3Comments

svanharmelen picture svanharmelen  路  3Comments