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

vimPlugins.vim-go: set g:go_bin_path to work with pure nix-shell #86626

Open
wants to merge 1 commit into
base: master
from

Conversation

@kalbasit
Copy link
Member

kalbasit commented May 3, 2020

Motivation for this change
  • It requires gopls, but it's missing because it's no longer provided by gotools.
  • It was relying on PATH to find the Go compiler. I've made an update to the plugin so it relies on g:go_bin_path when calling system() or when starting a job. I've filed a pull request upstream to fix this: fatih/vim-go#2876

Note My patch upstream works for Linux but will definitely break Windows support. I'm not sure we have any Windows use case for this.

Test NeoVim
nix-shell -I nixpkgs=. \
	--pure \
	-p which \
	-p 'with import <nixpkgs> {}; neovim.override { configure = { vam.pluginDictionaries = [ "vim-go" ]; }; }' \
		--run 'cd /path/to/project; export GOPATH=/path/to/gopath; vim main.go'
Test Vim
nix-shell -I nixpkgs=. \
	--pure \
	-p which \
	-p 'with import <nixpkgs> {}; vim_configurable.customize { name = "vim"; vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; { start = [ vim-go ]; }; }' \
		--run 'cd /path/to/project; export GOPATH=/path/to/gopath; vim main.go'
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@kalbasit kalbasit requested a review from jonringer as a code owner May 3, 2020
@kalbasit kalbasit changed the title vimPlugins.vim-go: set g:go_bin_path to work with pure nix-shell [WIP] vimPlugins.vim-go: set g:go_bin_path to work with pure nix-shell May 3, 2020
@kalbasit kalbasit changed the title [WIP] vimPlugins.vim-go: set g:go_bin_path to work with pure nix-shell vimPlugins.vim-go: set g:go_bin_path to work with pure nix-shell May 3, 2020
@kalbasit kalbasit marked this pull request as draft May 3, 2020
- It requires gopls, but it's missing because it's no longer provided by gotools.
- It was relying on PATH to find the Go compiler. I've made an update to
  the plugin so it relies on g:go_bin_path when calling system() or when
  starting a job. I've filed a pull request upstream to fix this:
  fatih/vim-go#2876
@kalbasit kalbasit force-pushed the kalbasit:pure-vim-go branch from 499c01f to 42b246b Jul 3, 2020
@kalbasit kalbasit marked this pull request as ready for review Jul 3, 2020
@kalbasit
Copy link
Member Author

kalbasit commented Jul 3, 2020

The pull request was not accepted upstream, but I still believe that this is the right thing to do as far as the plugin goes. @jonringer what do you think?

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

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.