gogrep
WIP: this is an attempt to move modified gogrep from the go-ruleguard project, so it can be used outside of the ruleguard as a library.
Acknowledgements
The original gogrep is written by the Daniel Martí.
WIP: this is an attempt to move modified gogrep from the go-ruleguard project, so it can be used outside of the ruleguard as a library.
The original gogrep is written by the Daniel Martí.
gogrep GO111MODULE=on go get mvdan.cc/gogrep Search for Go code using syntax trees. Work in progress. gogrep -x 'if $x != nil { return $x, $*_ }' In
hclgrep Search for HCL(v2) using syntax tree. The idea is heavily inspired by ht
gpool - a generic context-aware resizable goroutines pool to bound concurrency. Installation $ go get github.com/sherifabdlnaby/gpool import "github.c
sail 中文文档 sail is an operation framework based on Ansible/Helm. sail follows the principles of Infrastructure as Code (IaC), Operation as Code (OaC),a
syntaxhighlight Package syntaxhighlight provides syntax highlighting for code. It currently uses a language-independent lexer and performs decently on
syntaxhighlight Package syntaxhighlight provides syntax highlighting for code. It currently uses a language-independent lexer and performs decently on
shasm Assembly syntax that makes you feel like you're writing code in a high-level language. Shasm is not an Assembler. Shasm simply compiles Shasm sy
snippit creates syntax-highlighted code snippets in png or svg format. Installat
If you need to generate a lot of random data for your database tables but don't want to spend hours configuring a custom tool for the job, then datage
⚠️ Check zerolog, the successor of xlog. HTTP Handler Logger xlog is a logger for net/context aware HTTP applications. Unlike most loggers, xlog will
Xmux Xmux is a lightweight high performance HTTP request muxer on top xhandler. Xmux gets its speed from the fork of the amazing httprouter. Route par
Pomerium is an identity-aware proxy that enables secure access to internal applications. Pomerium provides a standardized interface to add access cont
reflow A collection of ANSI-aware methods and io.Writers helping you to transform blocks of text. This means you can still style your terminal output
depaware depaware makes you aware of your Go dependencies. It generates a list of your dependencies which you check in to your repo: https://github.co
Caire is a content aware image resize library based on Seam Carving for Content-Aware Image Resizing paper. How does it work An energy map (edge detec
holmes WARNING : holmes is under heavy development now, so API will make breaking change during dev. If you want to use it in production, please wait
Graphik is a Backend as a Service implemented as an identity-aware, permissioned, persistant document/graph database & pubsub server written in Go.
Consul Website: https://www.consul.io Tutorials: HashiCorp Learn Forum: Discuss Consul is a distributed, highly available, and data center aware solut
Crimson-Spray Crimson-Spray is a lockout aware password sprayer for active direc
Use a single struct type NodeSlice
to wrap all
kinds of ast.Node
slices; this allows us to have an allocation pool slice that can be used to
avoid allocations in most cases.
While some operations like NodeSlice.At
become slower, other operations like NodeSlice.SliceInto
are far more efficient: we can re-use memory even in re-slicing cases.
Benchmark results:
name old time/op new time/op delta
Match/failFast-8 178ns ± 1% 182ns ± 1% +2.18% (p=0.000 n=10+10)
Match/failCall-8 427ns ± 1% 414ns ± 1% -3.00% (p=0.000 n=10+9)
Match/failCallFast-8 176ns ± 0% 166ns ± 2% -6.07% (p=0.000 n=8+10)
Match/assign-8 251ns ± 1% 245ns ± 0% -2.29% (p=0.000 n=10+7)
Match/assignMulti-8 874ns ± 2% 586ns ± 1% -32.96% (p=0.000 n=10+10)
Match/simpleLit-8 109ns ± 1% 104ns ± 4% -4.15% (p=0.000 n=10+10)
Match/simpleBinaryOp-8 234ns ± 1% 235ns ± 4% ~ (p=0.986 n=10+10)
Match/simpleSelectorExpr-8 326ns ± 1% 308ns ± 1% -5.55% (p=0.000 n=9+10)
Match/simpleCall-8 310ns ± 1% 296ns ± 1% -4.25% (p=0.000 n=10+10)
Match/selectorExpr-8 343ns ± 1% 339ns ± 1% -1.10% (p=0.004 n=10+9)
Match/sliceExpr-8 261ns ± 1% 243ns ± 0% -6.89% (p=0.000 n=10+9)
Match/any-8 181ns ± 1% 187ns ± 3% +3.04% (p=0.000 n=10+10)
Match/anyCall-8 693ns ± 1% 514ns ± 1% -25.87% (p=0.000 n=10+10)
Match/ifStmt-8 558ns ± 1% 399ns ± 1% -28.51% (p=0.000 n=10+10)
Match/optStmt1-8 399ns ± 1% 375ns ± 1% -6.13% (p=0.000 n=10+10)
Match/optStmt2-8 276ns ± 1% 247ns ± 1% -10.64% (p=0.000 n=10+9)
Match/namedOptStmt1-8 2.00µs ± 1% 1.61µs ± 1% -19.18% (p=0.000 n=9+10)
Match/namedOptStmt2-8 1.33µs ± 1% 1.06µs ± 1% -20.07% (p=0.000 n=10+10)
Match/branchStmt-8 139ns ± 1% 137ns ± 1% -1.33% (p=0.000 n=10+10)
Match/multiStmt-8 1.23µs ± 1% 0.98µs ± 1% -20.06% (p=0.000 n=9+10)
Match/multiExpr-8 1.33µs ± 1% 1.03µs ± 1% -22.31% (p=0.000 n=9+10)
Match/variadicCall-8 254ns ± 2% 252ns ± 0% -0.79% (p=0.003 n=10+7)
Match/capture1-8 170ns ± 0% 167ns ± 1% -2.24% (p=0.000 n=9+9)
Match/capture2-8 257ns ± 1% 250ns ± 1% -2.75% (p=0.000 n=10+10)
Match/capture8-8 928ns ± 1% 919ns ± 1% -0.95% (p=0.000 n=10+10)
Match/capture2same-8 296ns ± 1% 283ns ± 0% -4.43% (p=0.000 n=10+9)
Match/capture8same-8 1.06µs ± 1% 1.03µs ± 1% -3.41% (p=0.000 n=9+10)
Match/captureBacktrackLeft-8 1.65µs ± 1% 1.10µs ± 1% -32.96% (p=0.000 n=10+8)
Match/captureBacktrackRight-8 1.08µs ± 2% 0.81µs ± 1% -24.89% (p=0.000 n=10+10)
Match/exprList-8 2.62µs ± 1% 2.32µs ± 1% -11.61% (p=0.000 n=10+8)
[Geo mean] 453ns 405ns -10.66%
name old alloc/op new alloc/op delta
Match/failFast-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/failCall-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/failCallFast-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/assign-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/assignMulti-8 192B ± 0% 96B ± 0% -50.00% (p=0.000 n=10+10)
Match/simpleLit-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/simpleBinaryOp-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/simpleSelectorExpr-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/simpleCall-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/selectorExpr-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/sliceExpr-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/any-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/anyCall-8 144B ± 0% 96B ± 0% -33.33% (p=0.000 n=10+10)
Match/ifStmt-8 80.0B ± 0% 32.0B ± 0% -60.00% (p=0.000 n=10+10)
Match/optStmt1-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/optStmt2-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/namedOptStmt1-8 344B ± 0% 224B ± 0% -34.88% (p=0.000 n=10+10)
Match/namedOptStmt2-8 168B ± 0% 96B ± 0% -42.86% (p=0.000 n=10+10)
Match/branchStmt-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/multiStmt-8 256B ± 0% 160B ± 0% -37.50% (p=0.000 n=10+10)
Match/multiExpr-8 256B ± 0% 160B ± 0% -37.50% (p=0.000 n=10+10)
Match/variadicCall-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/capture1-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/capture2-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/capture8-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/capture2same-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/capture8same-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
Match/captureBacktrackLeft-8 288B ± 0% 96B ± 0% -66.67% (p=0.000 n=10+10)
Match/captureBacktrackRight-8 168B ± 0% 96B ± 0% -42.86% (p=0.000 n=10+10)
Match/exprList-8 256B ± 0% 160B ± 0% -37.50% (p=0.000 n=10+10)
[Geo mean] 59.0B 48.2B -18.32%
The go install command line is incorrectly targeting quasilyte/cmd
. Also I had to add @latest
for my install.
% go install github.com/quasilyte/cmd/gogrep
go: 'go install' requires a version when current directory is not in a module
Try 'go install github.com/quasilyte/cmd/gogrep@latest' to install the latest version
% go install github.com/quasilyte/cmd/gogrep@latest
go: github.com/quasilyte/cmd/gogrep@latest: module github.com/quasilyte/cmd/gogrep: git ls-remote -q origin in /Users/h10s/go/pkg/mod/cache/vcs/a253bbdbe675c103bdc5b7cc11fdc04c92957a302426b744279f4eca15296a16: exit status 128:
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
% go install github.com/quasilyte/gogrep/cmd/gogrep@latest
go: downloading github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f
go: downloading github.com/quasilyte/gogrep/cmd/gogrep v0.0.0-20220828223005-86e4605de09f
go: downloading github.com/quasilyte/perf-heatmap v0.0.0-20211220153856-7361377975b8
go: downloading github.com/quasilyte/gogrep v0.0.0-20220320171548-f7f5e21cda54
go: downloading github.com/google/pprof v0.0.0-20211214055906-6f57359322fd
Introduced a new matcher op: maybeVariadicCallExpr. Unlike CallExpr, it doesn't unconditionally accept both variadic and non-variadic calls. Instead, it only accepts variadic calls if there are more than N arguments.
Take this pattern for example:
f($_, $_, $_, $*_)
Variadic call will be accepted only if there are more than 3 arguments passed to f.
f(a, b, c, 4) // ok
f(a, b, c, xs...) // ok
f(a, b, xs...) // NOT ok
Fixes #28
This will make it possible to format the output in a way that it can be processed by the other tool.
For example, that other script can sort the results using the scores.
We could do sorting in gogrep itself, but it looks like a relatively big feature that can be implemented outside (because there is more than 1 way to sort the output).
A tool for transpiling C code to Go code. Milestones of the project: Transpiling project GNU GSL. Transpiling project GTK+. Notes: Transpiler works on
f4go Example of use > # Install golang > # Compile f4go > go get -u github.com/Konstantin8105/f4go > cd $GOPATH/src/github.com/Konstantin8105/f4go > g
GopherJS - A compiler from Go to JavaScript GopherJS compiles Go code (golang.org) to pure JavaScript code. Its main purpose is to give you the opport
Grumpy: Go running Python Overview Grumpy is a Python to Go source code transcompiler and runtime that is intended to be a near drop-in replacement fo
Welcome to go2ast ?? Transform Go code into it's AST Usage echo "a := 1" | go run main.go Example output []ast.Stmt { &ast.AssignStmt {
regexp2go regexp2go is an alternate backend for the regexp package that allows to perform ahead-of-time compilation of regular expressions to Go code.
TinyGo - Go compiler for small places TinyGo is a Go compiler intended for use in small places such as microcontrollers, WebAssembly (Wasm), and comma
wagon wagon is a WebAssembly-based interpreter in Go, for Go. As of 2020/05/11 Wagon is in read-only mode, and looking for a maintainer. You may want
phpgrep Syntax-aware grep for PHP code. This repository is used for the library and command-line tool development. A good source for additional utilit
Go-based search engine URL collector , support Google, Bing, can be based on Google syntax batch collection URL