{"id":13693725,"url":"https://github.com/mvdan/gogrep","last_synced_at":"2025-05-02T22:30:30.366Z","repository":{"id":53297361,"uuid":"103824761","full_name":"mvdan/gogrep","owner":"mvdan","description":"Search for Go code using syntax trees","archived":true,"fork":false,"pushed_at":"2021-06-09T09:03:30.000Z","size":256,"stargazers_count":477,"open_issues_count":15,"forks_count":16,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-11-12T19:42:03.743Z","etag":null,"topics":["code","go","search","syntax"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mvdan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"mvdan"}},"created_at":"2017-09-17T11:49:23.000Z","updated_at":"2024-10-17T07:07:52.000Z","dependencies_parsed_at":"2022-09-13T03:11:02.733Z","dependency_job_id":null,"html_url":"https://github.com/mvdan/gogrep","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvdan%2Fgogrep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvdan%2Fgogrep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvdan%2Fgogrep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvdan%2Fgogrep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mvdan","download_url":"https://codeload.github.com/mvdan/gogrep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252115851,"owners_count":21697254,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code","go","search","syntax"],"created_at":"2024-08-02T17:01:16.338Z","updated_at":"2025-05-02T22:30:28.281Z","avatar_url":"https://github.com/mvdan.png","language":"Go","readme":"# gogrep\n\n\tGO111MODULE=on go get mvdan.cc/gogrep\n\nSearch for Go code using syntax trees.\n\n\tgogrep -x 'if $x != nil { return $x, $*_ }'\n\nNote that this project is **no longer being developed**.\nSee https://github.com/mvdan/gogrep/issues/64 for more details.\n\n### Instructions\n\n\tusage: gogrep commands [packages]\n\nA command is of the form \"-A pattern\", where -A is one of:\n\n       -x  find all nodes matching a pattern\n       -g  discard nodes not matching a pattern\n       -v  discard nodes matching a pattern\n       -a  filter nodes by certain attributes\n       -s  substitute with a given syntax tree\n       -w  write source back to disk or stdout\n\nA pattern is a piece of Go code which may include wildcards. It can be:\n\n       a statement (many if split by semicolons)\n       an expression (many if split by commas)\n       a type expression\n       a top-level declaration (var, func, const)\n       an entire file\n\nWildcards consist of `$` and a name. All wildcards with the same name\nwithin an expression must match the same node, excluding \"_\". Example:\n\n       $x.$_ = $x // assignment of self to a field in self\n\nIf `*` is before the name, it will match any number of nodes. Example:\n\n       fmt.Fprintf(os.Stdout, $*_) // all Fprintfs on stdout\n\n`*` can also be used to match optional nodes, like:\n\n\tfor $*_ { $*_ }    // will match all for loops\n\tif $*_; $b { $*_ } // will match all ifs with condition $b\n\nThe nodes resulting from applying the commands will be printed line by\nline to standard output.\n\nHere are two simple examples of the -a operand:\n\n       gogrep -x '$x + $y'                   // will match both numerical and string \"+\" operations\n       gogrep -x '$x + $y' -a 'type(string)' // matches only string concatenations\n","funding_links":["https://github.com/sponsors/mvdan"],"categories":["开源类库","Open source library"],"sub_categories":["文本处理","Word Processing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvdan%2Fgogrep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvdan%2Fgogrep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvdan%2Fgogrep/lists"}