Skip to content

GoCallers, GoCallee, GoCallStack : Exlude test code in search #1843

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

Closed
vimalk78 opened this issue May 28, 2018 · 4 comments
Closed

GoCallers, GoCallee, GoCallStack : Exlude test code in search #1843

vimalk78 opened this issue May 28, 2018 · 4 comments

Comments

@vimalk78
Copy link

vimalk78 commented May 28, 2018

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

:GoCallers

What did you expect to happen?

return all the callers of this function

What happened instead?

ALL callers were returned

Configuration (MUST fill this out):

  • vim-go version:
    master branch, upto commit 1b8d099
    (how to find the version btw ?)

  • vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):

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

:version                                                                                                                                                                                                    
NVIM v0.2.2                                                                                                                                                                                                 
Build type: RelWithDebInfo                                                                                                                                                                                  
LuaJIT 2.0.4                                                                                                                                                                                                
Compilation: /usr/bin/x86_64-linux-gnu-gcc -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=2 -Wconversion
 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong
 -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/neovim-HJnLxJ/neovim-0.2.2/build/config -I/build/neovim-HJnLxJ/neovim-0.2.2/src -I/usr/include -I/usr/include -I/usr/inclu
de -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/build/neovim-HJnLxJ/neovim-0.2.2/build/src/nvim/auto -I/build/neovim-HJnLxJ/neovim-0.2.2/build/include                                    
Compiled by [email protected]                                                                                                                                                     
                                                                                                                                                                                                            
Features: +acl +iconv +jemalloc +tui                                                                                                                                                                        
See ":help feature-compile"                                                                                                                                                                                 
                                                                                                                                                                                                            
   system vimrc file: "$VIM/sysinit.vim"                                                                                                                                                                    
  fall-back for $VIM: "/usr/share/nvim"  
  • Go version (go version):

go version go1.10.2 linux/amd64

  • Go environment (go env):
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/vimal/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/vimal/gowork"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build593363879=/tmp/go-build -gno-record-gcc-switches"

Is it possible to exclude test code while searching for GoCallers, GoCallee, GoCallStack'.
because not only it takes longer to finish the call, it also results more results

@vimalk78 vimalk78 changed the title GoCallers, GoCallee, GoCallStack : Exlude test code in GoCallers GoCallers, GoCallee, GoCallStack : Exlude test code in search May 28, 2018
@fatih
Copy link
Owner

fatih commented May 28, 2018

@vimalk78 it's not possible to change the output of these commands, because that is how guru works. I recommend you use a simple Go example, use guru inside the terminal to see the output and open an issue to https://github.com/golang/go/issues with the results you have and what you think should happen. Thanks

@fatih fatih closed this as completed May 28, 2018
@vimalk78
Copy link
Author

Thanks a lot Fatih.
I will do as you recommended.

@vimalk78
Copy link
Author

created the issue
golang/go#25607

@adriafarres
Copy link

adriafarres commented Feb 9, 2022

You can filter the location list.

Add the cfilter plugin that comes with vim:

packadd cfilter

Call GoCallers on some word and then filter the location list with:

:Lfilter! _test.go

You could set up a command that does it for you. I can't seem to make it work without the sleep, since vim doesn't seem to detect the location list until certain amount of time has passed. If anyone has a better solution, feel free to reply.

nnoremap <silent> <Leader>C :GoCallers<cr>:sleep 100m<cr>:Lfilter! _test.go<cr>

If you want to jump immediately to the location list, you can add :lopen<cr> to the end of the mapping above.

Ideally, that should be supported by Guru, but the solution above is a good temporary solution, I think.

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

3 participants