ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
2.14k stars 125 forks source link

gotest arguments #229

Closed roychoo closed 2 years ago

roychoo commented 2 years ago

Hi,

wish to ask, how can i pass additional arguments to GoTestXXX?

ray-x commented 2 years ago

e.g. GoTestXXXX -flags -flags should be forward to go test

local long_opts = {
  verbose = "v",
  compile = "c",
  coverage = "C",
  count = "n",
  tags = "t",
  bench = "b",
  metric = "m",
  select = "s",
  floaterm = "F",
}

As long as it does not start with the above options (v, c, C, n ...)

roychoo commented 2 years ago

hi, i tried and it didnt.

GoTestFunc -args mock=true became go test -tags=tag1,tag2 -v -run '^Test$' ./test mock=true exited with code: 1 failed

expecting go test -tags=tag1,tag2 -v -run '^Test$' ./test -args mock=true

ray-x commented 2 years ago

well, it is correct the -args is not correct supported. I have to add an extra args '-a' for this. So to run test with args, you have to use -a, e.g. GoTest -a mock=true

ray-x commented 2 years ago

I assume this can be close with above PR