An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/dimchansky/grind

Grind polishes Go programs. Usage: Grind rewrites the source files in the named packages. When grind rewrites a file, it prints a line to standard error giving the name of the file and the rewrites applied. As a special case, if the arguments are a list of Go source files, they are considered to make up a single package, which is then rewritten. If the -diff flag is set, no files are rewritten. Instead grind prints the differences a rewrite would introduce. Grind does not make backup copies of the files that it edits. Instead, use a version control system's “diff” functionality to inspect the changes that grind makes before committing them. Grind is a work in progress. More rewrites are planned. The initial use case for grind is cleaning up Go code that looks like C code. Grind removes unreachable (dead) code. Code is considered unreachable if it is not the target of a goto statement and is preceded by a terminating statement (see golang.org/ref/spec#Terminating_statements), or a break or continue statement. If the target of a goto is a block of code that is only reachable by following that goto statement, grind replaces the goto with a copy of the target code and deletes the original target code. If the target of a goto is an explicit or implicit return statement, replaces the goto with a copy of the return statement. Grind removes unused labels. Grind rewrites := declarations of complex zero types, such as: to use plain var declarations, as in: Grind moves var declarations as close as possible to their uses. When possible, it combines the declaration with the initialization, and it splits disjoint uses of a single variable into multiple variables. For example, consider: Grind deletes the declaration and rewrites both loop initializers to use a combined declaration and assignment (i := 0). Limitation: Grind does not move variable declarations into loop bodies. It may in the future, provided it can determine that the variable is dead on entry to the body and that the variable does not escape (causing heap allocation inside the loop). Limitation: Grind considers variables that appear in closures off limits. A more sophisticated analysis might consider them in the future.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/dimchansky/grind
License: BSD-3-Clause
Latest release: almost 9 years ago
First release: almost 9 years ago
Namespace: github.com/dimchansky
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 1 month ago

    Loading...
    Readme
    Loading...