{"id":304952,"date":"2020-06-07T03:00:13","date_gmt":"2020-06-07T03:00:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=304952"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=304952","title":{"rendered":"gogrep: \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0438 \u0437\u0430\u043c\u0435\u043d\u0430 Go \u043a\u043e\u0434\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/505652\/\">\n<p><a href=\"https:\/\/github.com\/mvdan\/gogrep\" rel=\"nofollow\">gogrep<\/a> \u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u043c\u043e\u0438\u0445 \u043b\u044e\u0431\u0438\u043c\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Go. \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u0434 \u043f\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c, \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e \u0442\u0438\u043f\u0430\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0443 (\u0442\u043e\u0436\u0435 \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443).<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>gogrep<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=quasilyte.gogrep\" rel=\"nofollow\">VS Code \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438<\/a> \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <code>gogrep<\/code> \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/l7\/s7\/gc\/l7s7gccru4deae3xyln5scwfof8.jpeg\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"zachem-nuzhen-gogrep\">\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u0435\u043d gogrep<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u0442\u0435\u0437\u0438\u0441\u0430\u0445, \u0442\u043e <code>gogrep<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u043f\u0440\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0420\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0435<\/li>\n<li>\u0418\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b<\/li>\n<li>\u041f\u043e\u0438\u0441\u043a\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (\u043f\u0440\u0438\u043c\u0435\u0440: <a href=\"https:\/\/habr.com\/ru\/post\/481696\/\">ruleguard<\/a>)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u044f\u0449\u043d\u043e\u0441\u0442\u044c \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 <code>a()<\/code> \u0438 <code>b()<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">func a(xs []int) []int {   xs = append(xs, 1)   xs = append(xs, 2)   return xs }  func b(xs []int) []int {   xs = append(xs, 1, 2)   return xs }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u043c\u0435\u0441\u0442\u0430, \u0433\u0434\u0435 \u0432\u044b\u0437\u043e\u0432\u044b <code>append<\/code> \u043c\u043e\u0436\u043d\u043e \u0441\u0445\u043b\u043e\u043f\u043d\u0443\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c <code>gogrep<\/code>:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u0430\u0440\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>-x<\/code> \u0448\u0430\u0431\u043b\u043e\u043d\u0430 <code>$x=append($x,$a); $x=append($x,$b)<\/code><\/li>\n<li>\u0427\u0435\u0440\u0435\u0437 <code>-s<\/code> \u0448\u0430\u0431\u043b\u043e\u043d <code>$x=append($x,$a,$b)<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0441\u043a\u043e\u043c\u0443\u044e \u0437\u0430\u043c\u0435\u043d\u0443<\/li>\n<li>\u041f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>-w<\/code> \u0432\u0441\u0435 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u044b.<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"bash\">gogrep -w -x '$x=append($x,$a);$x=append($x,$b)' -s '$x=append($x,$a,$b)' .\/...<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=quasilyte.gogrep\" rel=\"nofollow\">\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f VS Code<\/a>, \u0442\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0435\u0449\u0451 \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u043c\u0435\u043d\u044b <code>+=1<\/code> \u043d\u0430 <code>++<\/code>:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bc\/pq\/1x\/bcpq1xmkv2fq3annn9oo0lu9t6i.gif\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438: \u043a\u0430\u043a-\u0442\u043e \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0443 <code>slice[:] -&gt; slice<\/code>. \u0414\u0430\u0436\u0435 \u0437\u0430\u0432\u043e\u0434\u0438\u043b <a href=\"https:\/\/github.com\/dominikh\/go-tools\/issues\/282\" rel=\"nofollow\">issue \u0432 staticcheck<\/a>. \u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043a\u0430\u0442\u044c <code>[:]<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0441\u043b\u0430\u0439\u0441 \u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b, \u0430 \u0432\u043e\u0442 \u043e\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u043b\u0438 \u0441\u043b\u0430\u0439\u0441\u0430 \u2014 \u043d\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u043b\u0430\u0439\u0441\u044b \u043e\u0442 <code>[]byte<\/code> \u0432 stdlib:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\"># \u0422\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0438\u0441\u043a. gogrep -x '$s[:]' -a 'type([]byte)' std  # \u041f\u043e\u0438\u0441\u043a+\u0437\u0430\u043c\u0435\u043d\u0430. gogrep -x '$s[:]' -a 'type([]byte)' -s '$s' -w std<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u0439\u0434\u0451\u0442 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<hr>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0435 30 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 (\u0432\u0441\u0435\u0433\u043e \u0438\u0445 300+):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$GOROOT\/src\/archive\/tar\/format.go:163:59: b[:] $GOROOT\/src\/archive\/tar\/reader.go:345:33: tr.blk[:] $GOROOT\/src\/archive\/tar\/reader.go:348:17: tr.blk[:] $GOROOT\/src\/archive\/tar\/reader.go:348:28: zeroBlock[:] $GOROOT\/src\/archive\/tar\/reader.go:349:34: tr.blk[:] $GOROOT\/src\/archive\/tar\/reader.go:352:18: tr.blk[:] $GOROOT\/src\/archive\/tar\/reader.go:352:29: zeroBlock[:] $GOROOT\/src\/archive\/tar\/reader.go:396:23: tr.blk[:] $GOROOT\/src\/archive\/tar\/reader.go:497:36: blk[:] $GOROOT\/src\/archive\/tar\/reader.go:528:33: blk[:] $GOROOT\/src\/archive\/tar\/reader.go:531:14: blk[:] $GOROOT\/src\/archive\/tar\/writer.go:392:26: blk[:] $GOROOT\/src\/archive\/tar\/writer.go:477:23: zeroBlock[:] $GOROOT\/src\/archive\/zip\/reader.go:233:29: buf[:] $GOROOT\/src\/archive\/zip\/reader.go:236:15: buf[:] $GOROOT\/src\/archive\/zip\/reader.go:251:30: buf[:] $GOROOT\/src\/archive\/zip\/reader.go:254:15: buf[:] $GOROOT\/src\/archive\/zip\/writer.go:92:17: buf[:] $GOROOT\/src\/archive\/zip\/writer.go:110:19: buf[:] $GOROOT\/src\/archive\/zip\/writer.go:116:30: buf[:] $GOROOT\/src\/archive\/zip\/writer.go:132:27: buf[:] $GOROOT\/src\/archive\/zip\/writer.go:157:17: buf[:] $GOROOT\/src\/archive\/zip\/writer.go:177:27: buf[:] $GOROOT\/src\/archive\/zip\/writer.go:190:16: buf[:] $GOROOT\/src\/archive\/zip\/writer.go:198:26: buf[:] $GOROOT\/src\/archive\/zip\/writer.go:314:18: mbuf[:] $GOROOT\/src\/archive\/zip\/writer.go:319:31: mbuf[:] $GOROOT\/src\/archive\/zip\/writer.go:386:16: buf[:] $GOROOT\/src\/archive\/zip\/writer.go:398:23: buf[:] $GOROOT\/src\/bytes\/bytes.go:172:24: b[:]<\/code><\/pre>\n<p>  <\/p>\n<hr>\n<\/div><\/div>\n<p>  <\/p>\n<h2 id=\"poiskovye-shablony\">\u041f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u2014 \u044d\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 Go \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u044f $-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0445 &quot;\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430&quot;). \u0428\u0430\u0431\u043b\u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c, statement (\u0438\u043b\u0438 \u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u043c) \u0438\u043b\u0438 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u2014 \u044d\u0442\u043e Go \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c <code>$<\/code>. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b AST. \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>$_<\/code>, \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f &quot;\u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e&quot;.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c <code>*<\/code>, \u0442\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u041f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d<\/th>\n<th>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u044f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>$_<\/code><\/td>\n<td>\u0427\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e.<\/td>\n<\/tr>\n<tr>\n<td><code>$x<\/code><\/td>\n<td>\u0418\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443, &quot;\u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e&quot;.<\/td>\n<\/tr>\n<tr>\n<td><code>$x = $x<\/code><\/td>\n<td>\u0421\u0430\u043c\u043e\u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435.<\/td>\n<\/tr>\n<tr>\n<td><code>(($_))<\/code><\/td>\n<td>\u041b\u044e\u0431\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0434\u0432\u043e\u0439\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445.<\/td>\n<\/tr>\n<tr>\n<td><code>if $init; $cond {$x} else {$x}<\/code><\/td>\n<td><code>if<\/code> \u0441 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0438\u0441\u044f then\/else \u0431\u043b\u043e\u043a\u0430\u043c\u0438.<\/td>\n<\/tr>\n<tr>\n<td><code>fmt.Fprintf(os.Stdout, $*_)<\/code><\/td>\n<td>\u0412\u044b\u0437\u043e\u0432 <code>Fprintf<\/code> \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c <code>os.Stdout<\/code>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441 <code>append()<\/code>, \u0448\u0430\u0431\u043b\u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e statement&#8217;\u043e\u0432. \u041d\u043e\u0442\u0430\u0446\u0438\u044f &quot;<code>$x; $y<\/code>&quot; \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 &quot;\u043d\u0430\u0439\u0434\u0438 $x, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 $y&quot;.<\/p>\n<p>  <\/p>\n<p><code>gogrep<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0447\u0435\u0441\u0442\u043d\u044b\u0439 backtracking \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0441 <code>*<\/code>. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 <code>map<\/code> \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u043a\u043b\u044e\u0447:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">map[$_]$_{$*_, $key: $val1, $*_, $key: $val2, $*_}<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"konveyery-i-komandy-gogrep\">\u041a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u044b \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b gogrep<\/h2>\n<p>  <\/p>\n<p>\u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>-x<\/code> \u0438 <code>-s<\/code>, \u043d\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u044f \u0447\u0442\u043e \u043e\u043d\u0438 \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442.<\/p>\n<p>  <\/p>\n<p><code>gogrep<\/code> \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 (pipeline). \u041f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043e\u043c\u0430\u043d\u0434 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u0438\u043d\u043e\u043f\u0441\u0438\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">gogrep commands... [targets...]<\/code><\/pre>\n<p>  <\/p>\n<p><code>target<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0444\u0430\u0439\u043b\u043e\u043c, \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0435\u0439 \u0438\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u043c. \u0412\u0441\u0451 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>go build<\/code>.<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u041a\u043e\u043c\u0430\u043d\u0434\u0430<\/th>\n<th>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>-x pattern<\/code><\/td>\n<td>\u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b AST, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u043f\u043e\u0434 <code>pattern<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code>-g pattern<\/code><\/td>\n<td>\u041e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u043f\u043e\u0434 <code>pattern<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code>-v pattern<\/code><\/td>\n<td>\u041e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u043f\u043e\u0434 <code>pattern<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code>-a attr<\/code><\/td>\n<td>\u041e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <code>attr<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code>-s pattern<\/code><\/td>\n<td>\u041f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>pattern<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code>-p n<\/code><\/td>\n<td>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u043f\u043e\u0434\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0430 <code>n<\/code> \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u043f\u043e AST.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, <code>-x<\/code> \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435. \u0417\u0430\u0442\u0435\u043c \u043c\u043e\u0433\u0443\u0442 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u043b\u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u043e \u0432\u0441\u0451 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">\/\/ file foo.go package foo  func bar() {     println(1)     println(2)     println(3) }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"bash\"># \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b println() $ gogrep -x 'println($*_)' foo.go foo.go:4:2: println(1) foo.go:5:2: println(2) foo.go:6:2: println(3)  # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b -v \u0434\u043b\u044f \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, # \u0433\u0434\u0435 \u0435\u0441\u0442\u044c \u043b\u0438\u0442\u0435\u0440\u0430\u043b 1, \u0430 \u0437\u0430\u0442\u0435\u043c \u043b\u0438\u0442\u0435\u0440\u0430\u043b 2. $ gogrep -x 'println($*_)' -v 1 -v 2 foo.go foo.go:6:2: println(3)  # \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c\u0441\u044f \u043d\u0430 2 \u0443\u0440\u043e\u0432\u043d\u044f \u0432\u044b\u0448\u0435 # \u0438 \u0434\u043e\u0445\u043e\u0434\u0438\u043c \u0434\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e *ast.BlockStmt. $ gogrep -x 'println($*_)' -v 1 -v 2 -p 2 foo.go foo.go:3:12: { println(1); println(2); println(3); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u0442\u0443\u0430\u0442\u0438\u0432\u043d\u0430\u044f, \u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u043d\u0438\u0445 \u043d\u0435\u0442 \u0441\u043e\u0432\u0441\u0435\u043c. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/mvdan\/gogrep\/blob\/24e8804e5b3cbe82de972195f127eb3c3592d94b\/parse.go#L362\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>type<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\"># \u041c\u0430\u0442\u0447\u0438\u0442 \u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438 \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u044e. gogrep -x '$lhs + $rhs'  # \u041c\u0430\u0442\u0447\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u044e. gogrep -x '$lhs + $rhs' -a 'type(string)'<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <code>gogrep<\/code> \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0441\u0442\u043e\u0438\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>-tests<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"obzor-vozmozhnostey-vs-code-rasshireniya\">\u041e\u0431\u0437\u043e\u0440 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 VS Code \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c (<code>Ctrl+Shift+P<\/code> \u0438\u043b\u0438 <code>Cmd+Shift+P<\/code>):<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/t6\/to\/yt\/t6toytgl4xxl07-twzwidbguzlu.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/y8\/4q\/f9\/y84qf9p7mxjajc0oligrbt_8tho.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0435\u0447\u0430\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u0430\u043d\u0430\u043b (output channel) <code>gogrep<\/code>:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pj\/c6\/h-\/pjc6h-nobw_bpbly_51t-cgi-sk.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f search and replace \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u0447\u0430\u0441\u0442\u0438 &quot;Find&quot; \u0438 &quot;Replace&quot; \u0442\u043e\u043a\u0435\u043d\u043e\u043c <code>-&gt;<\/code>:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/72\/7c\/yy\/727cyy4mbar0zq937ya_qfzrovo.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 <code>!<\/code>, \u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0444\u0430\u0439\u043b\u043e\u0432 inplace \u0432 \u043a\u0430\u043d\u0430\u043b \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u043d\u044b \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0435\u0445 \u0441\u0430\u043c\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u0435\u043c\u044b\u0445 <code>append<\/code> (\u043d\u043e \u0431\u0435\u0437 replace):<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hn\/nc\/zc\/hnnczclqvnxb1maimtze2qlkrqo.gif\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0437\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043d\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0433\u043e\u0440\u044f\u0447\u0438\u0445 \u043a\u043b\u0430\u0432\u0438\u0448. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0438\u0441\u043a\u0443, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0438\u0445 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0441\u043b\u0435\u0434\u0443\u044f \u043b\u0438\u0447\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u044f\u043c \u044d\u0440\u0433\u043e\u043d\u043e\u043c\u0438\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0430 <code>gogrep<\/code> \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f <code>GOARCH=amd64<\/code> \u0438 <code>GOOS=linux|windows|darwin<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u044b. \u0418\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e <code>-x<\/code> \u0438 <code>-s<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0438\u043b\u0438 \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u0431\u0430\u0433, \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u0438 \u043d\u0435 \u043b\u0435\u043d\u0438\u0442\u0435\u0441\u044c <a href=\"https:\/\/github.com\/quasilyte\/vscode-gogrep\/issues\/new\" rel=\"nofollow\">\u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c issue \u043d\u0430 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0430 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b JetBrains, \u0442\u043e \u0432\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u043d\u0430\u043a\u043e\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <a href=\"https:\/\/www.jetbrains.com\/help\/idea\/structural-search-and-replace.html\" rel=\"nofollow\">structural search and replace<\/a> (SSR). \u041e\u043d \u0440\u0435\u0448\u0430\u044e\u0442 \u0442\u0443 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0443, \u043d\u043e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 SSR, <code>gogrep<\/code> \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/talks.godoc.org\/github.com\/mvdan\/talks\/2018\/gogrep.slide\" rel=\"nofollow\">Daniel Mart\u00ed \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043e gogrep<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/quasilyte\/go-ruleguard\/blob\/master\/rules.go\" rel=\"nofollow\">\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 gogrep \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432<\/a><\/li>\n<li>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f PHP \u2014 <a href=\"https:\/\/habr.com\/ru\/post\/464893\/\">phpgrep<\/a><\/li>\n<li><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=quasilyte.phpgrep\" rel=\"nofollow\">VS Code \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f phpgrep<\/a><\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/505652\/\"> https:\/\/habr.com\/ru\/post\/505652\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/505652\/\">\n<p><a href=\"https:\/\/github.com\/mvdan\/gogrep\" rel=\"nofollow\">gogrep<\/a> \u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u043c\u043e\u0438\u0445 \u043b\u044e\u0431\u0438\u043c\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Go. \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u0434 \u043f\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c, \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e \u0442\u0438\u043f\u0430\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0443 (\u0442\u043e\u0436\u0435 \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443).<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>gogrep<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=quasilyte.gogrep\" rel=\"nofollow\">VS Code \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438<\/a> \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <code>gogrep<\/code> \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/l7\/s7\/gc\/l7s7gccru4deae3xyln5scwfof8.jpeg\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-304952","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/304952","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=304952"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/304952\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=304952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=304952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=304952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}