wtfunc

command module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 9 Imported by: 0

README

wtfunc

Find what Go function is on a given line of a file. This is intended to be a building block for other tools, e.g. an editor plugin that runs the test at the current cursor position.

Installation

go get -u github.com/jim/wtfunc

Usage

Find function on a specific line using --line

Pass the path to a valid Go file on the command line or the contents of such a file via standard in. Pass the line number to check for a function body with -line. This program uses Go's standard flag parsing and requires that the -line flag comes before the filename.

$ wtfunc -line 21 main.go
run
Get the list of all functions in a file using -list:
$ wtfunc -list main.go
main
run
Limit results to test funcs using -test

This works with either -list or -line and includes only functions whose names begin with "Test":

$ wtfunc -test -list main_test.go
TestCLI
$ wtfunc -test -line 25 main_test.go
TestCLI

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL