gogrep

command module
v0.0.0-...-79713fe Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2017 License: BSD-3-Clause Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gogrep

Rog and Dan's drunken idea. Work in progress.

go get -u mvdan.cc/gogrep

Its first argument is a pattern to match. It can be any Go expression or statement, which may include wildcards. Wildcards are identifiers preceded by $.

$ gogrep 'if $x != nil { return $x }'
main.go:47:2: if err != nil { return err; }
main.go:60:2: if err != nil { return err; }

All wildcards with the same name must match the same syntax node. In other words, they must be equal in the source code. The $_ wildcard doesn't follow this rule, so it can be used to match anything regardless of how often it is used.

You can also use a * wildcard suffix to match any number of expressions or statements, such as:

$ gogrep 'if err != nil { $_* }'
main.go:47:2: if err != nil { return err; }
main.go:60:2: if err != nil { return err; }
tokenize.go:42:3: if err != nil { return nil, err; }

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
⌂ 换网址