Skip to content
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

:GoRun works, <Leader>r doesn't #542

Closed
BooneJS opened this issue Sep 18, 2015 · 7 comments
Closed

:GoRun works, <Leader>r doesn't #542

BooneJS opened this issue Sep 18, 2015 · 7 comments

Comments

@BooneJS
Copy link

BooneJS commented Sep 18, 2015

Hi,

I have multiple files in a directory, all of which are a part of package main. :GoRun works like "go run *.go", but r seems to perform "go run ", which then results in undefined functions from the other .go files.

Thanks!

@fatih
Copy link
Owner

fatih commented Sep 28, 2015

Hi @BooneJS

:GoRun only passes the files that are dependent on the current file you apply :GoRun. So it's actually like go run *.go but it's more smarter. How does it break for you? Can you provide a detailed test case?

@fatih
Copy link
Owner

fatih commented Oct 11, 2015

Closing this as I didn't receive any response in two weeks. Please feel free to reopen.

@fatih fatih closed this as completed Oct 11, 2015
@fawick
Copy link

fawick commented Oct 29, 2015

Would reopen this, but I lack the permissions. Here is how I was able to reproduce this:

$ cat a.go
package main

func main() {
        b()
}
$ cat b.go
package main

func b() {
}

I opened a.go in vim, entered <leader>r, and then received the following message:

# command-line-arguments
./a.go:4: undefined: b

:GoRun works. The mapping is set up like this: au FileType go map <leader>r :wa<CR><Plug>(go-run)

Edit: Here is the relevant version for me

$ git describe --tags
v1.2-22-g8f11f67

@abits
Copy link

abits commented Feb 1, 2016

Same behavior here for me. Seems like (go-run) is defined as :GoRun % as discussed here. So I was able to work around by defining the key binding like this:

au Filetype go nnoremap <leader>r :GoRun<CR>

This setting allows me to run the equivalent of go run *.go in vim.

@fatih fatih reopened this Feb 8, 2016
@fatih fatih closed this as completed in afa2963 Feb 8, 2016
@fatih
Copy link
Owner

fatih commented Feb 8, 2016

This is fixed now. Please pull the latest master or wait for the next version release.

Thanks for the feedback @fawick @abits .

@fawick
Copy link

fawick commented Feb 8, 2016

Great! Thanks, @fatih!

@BooneJS
Copy link
Author

BooneJS commented Feb 8, 2016

Thanks!

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

4 participants