<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Roman Budnikov</title>
    <description>The latest articles on Forem by Roman Budnikov (@sekimori_roma).</description>
    <link>https://forem.com/sekimori_roma</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3666542%2F0eb30e8e-1a00-4098-a442-1c0dd67d3ebc.png</url>
      <title>Forem: Roman Budnikov</title>
      <link>https://forem.com/sekimori_roma</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sekimori_roma"/>
    <language>en</language>
    <item>
      <title>Too much code, too many PRs. AI, please send help!</title>
      <dc:creator>Roman Budnikov</dc:creator>
      <pubDate>Thu, 25 Dec 2025 13:23:51 +0000</pubDate>
      <link>https://forem.com/sekimori_roma/too-much-code-too-many-prs-ai-please-send-help-13i9</link>
      <guid>https://forem.com/sekimori_roma/too-much-code-too-many-prs-ai-please-send-help-13i9</guid>
      <description>&lt;p&gt;&lt;strong&gt;The "Code Review" Bottleneck&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With the emergence of tools like &lt;strong&gt;Cursor&lt;/strong&gt;, or &lt;strong&gt;Antigravity&lt;/strong&gt;, writing code has become easier and faster than ever before. They can generate boilerplate, tests, and entire modules in seconds (provided you ask them nicely, of course).&lt;/p&gt;

&lt;p&gt;However, there’s a catch: quality checks are still performed by humans. And our capacity to read and comprehend someone else's code remains exactly where it was.&lt;/p&gt;

&lt;p&gt;As a result, the volume of Pull Requests (PRs) is growing, while the throughput of the review team remains the same. Code review is turning into a bottleneck. It’s a cycle: AI created the problem of excessive code volume. It’s only logical to assume that AI should help us clean up the mess.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Toolkit: Google Genkit &amp;amp; Go&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Google recently introduced a new ecosystem of tools for AI development, including the &lt;strong&gt;Agent Development Kit (ADK)&lt;/strong&gt; and &lt;strong&gt;Genkit&lt;/strong&gt;. As a Go developer, the biggest news for me was that all these tools were launched with official Go libraries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Experiment: A DIY AI Reviewer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Just for fun, and to test drive the new libraries, I decided to run an experiment: build a simple CLI agent to act as a first-pass code reviewer.&lt;/p&gt;

&lt;p&gt;The concept behind reviewer is simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetch the diff from a Merge Request via the GitLab API.&lt;/li&gt;
&lt;li&gt;Feed this context to a model using Genkit.&lt;/li&gt;
&lt;li&gt;Ask the model to identify bugs, style guide violations, or potential security issues.&lt;/li&gt;
&lt;li&gt;Post the feedback as comments back to GitLab.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The source code is open and available here: &lt;a href="//gitlab.com/romanyx/reviewer"&gt;gitlab.com/romanyx/reviewer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works in CI/CD&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The key feature is the ease of integration. The tool runs as a standard binary, so it can be easily added as a separate stage in your &lt;code&gt;.gitlab-ci.yml&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;stages&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;review&lt;/span&gt;

&lt;span class="na"&gt;review-code&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;review&lt;/span&gt;
  &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;registry.gitlab.com/romanyx/reviewer:latest&lt;/span&gt;
  &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/app/reviewer&lt;/span&gt;
  &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$CI_PIPELINE_SOURCE == "merge_request_event"&lt;/span&gt;
      &lt;span class="na"&gt;when&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;manual&lt;/span&gt;
  &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;GITLAB_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$GITLAB_TOKEN&lt;/span&gt;
    &lt;span class="na"&gt;GEMINI_API_KEY&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$GEMINI_API_KEY&lt;/span&gt;
    &lt;span class="na"&gt;PROJECT_ID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$CI_PROJECT_ID&lt;/span&gt;
    &lt;span class="na"&gt;MR_ID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$CI_MERGE_REQUEST_IID&lt;/span&gt;
    &lt;span class="na"&gt;REVIEWER_PROMPT&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
      &lt;span class="s"&gt;You are a Principal Golang Engineer acting as a code reviewer.&lt;/span&gt;
      &lt;span class="s"&gt;Your task is to analyze the changes in this Merge Request and provide constructive feedback.&lt;/span&gt;
      &lt;span class="s"&gt;Follow https://github.com/uber-go/guide/blob/master/style.md guides, Golang best practices and SOLID principles.&lt;/span&gt;
      &lt;span class="s"&gt;If the code is good, don't do any comments.&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The pipeline triggers whenever a Merge Request is created. The bot scans the changes and leaves comments directly on the lines of code where it spots issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Result?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Here is a live example of the bot in action: &lt;a href="https://gitlab.com/romanyx/reviewer-demo/-/merge_requests/2" rel="noopener noreferrer"&gt;Demo Merge Request&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The bot, on demand, walked through the changes and highlighted areas that needed attention. Of course, it won’t replace a deep architectural review (though maybe it could, with the right workflow and better context) or an understanding of the business context. But it works great as a first pass, catching simple mistakes so we don't have to.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is it worth using?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;It depends. Traditional linters are deterministic: they are perfect for catching syntax errors, unused variables, or formatting issues. They are fast, free and 100% accurate based on their rules.&lt;/p&gt;

&lt;p&gt;On the other hand, LLMs are probabilistic; they can hallucinate or miss things. They are not a "gatekeeper" like a compiler. But they serve as a "second pair of eyes" that runs 24/7 and never gets tired.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This experiment proved that integrating LLMs into our daily workflows is easy, especially with Go and Genkit. We can't stop the flood of LLMs-generated code, but we can definitely build better tools to manage it, and if your Merge Request inbox is overflowing, maybe it's time to delegate some tasks to a &lt;em&gt;robot&lt;/em&gt;.&lt;/p&gt;

</description>
      <category>go</category>
      <category>genkit</category>
      <category>gemini</category>
      <category>gitlab</category>
    </item>
    <item>
      <title>Teaching AI Modern Go: Solving the "Stuck-in-the-Past" Problem with Antigravity</title>
      <dc:creator>Roman Budnikov</dc:creator>
      <pubDate>Wed, 17 Dec 2025 09:40:45 +0000</pubDate>
      <link>https://forem.com/sekimori_roma/teaching-ai-modern-go-solving-the-stuck-in-the-past-problem-with-antigravity-37l0</link>
      <guid>https://forem.com/sekimori_roma/teaching-ai-modern-go-solving-the-stuck-in-the-past-problem-with-antigravity-37l0</guid>
      <description>&lt;p&gt;Last month, I changed my workflow. I switched from &lt;code&gt;vim&lt;/code&gt; as my primary code editor to Google's new &lt;strong&gt;Antigravity AI IDE&lt;/strong&gt;. It's an agentic platform that has significantly boosted my performance in writing, testing, and modifying code.&lt;/p&gt;

&lt;p&gt;Go is evolving fast. Recent versions introduced helpful features like integer ranges (Go 1.22 &lt;code&gt;for i := range 10&lt;/code&gt;) and standard library improvements (Go 1.24 &lt;code&gt;testing.B.Loop&lt;/code&gt;). Unfortunately, most LLMs  suffer from a "stuck-in-the-past" problem. Because they are trained on older code, they often suggest outdated code that works, but are no longer "idiomatic" or preferred in modern Go.&lt;/p&gt;

&lt;p&gt;Here is how I use &lt;code&gt;.agent/rules&lt;/code&gt; to enforce modern best practices.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem: Outdated Defaults
&lt;/h3&gt;

&lt;p&gt;For example lets take LeetCode problem: &lt;strong&gt;1. Two Sum&lt;/strong&gt;. Here is an example solution in Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;TwoSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;seen&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;comp&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;comp&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;seen&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you simply prompt the Agent with: &lt;code&gt;write benchmark for TwoSum function&lt;/code&gt;, it will likely generate a benchmark that looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;BenchmarkTwoSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;testing&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;B&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// Create a larger input for benchmarking&lt;/span&gt;
    &lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c"&gt;// Old style loop&lt;/span&gt;
        &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1997&lt;/span&gt; 

    &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResetTimer&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c"&gt;// Old style benchmark loop&lt;/span&gt;
        &lt;span class="n"&gt;TwoSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  The issues:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;It uses &lt;code&gt;for i := 0; i &amp;lt; 1000; i++&lt;/code&gt; instead of the modern Go 1.22 &lt;code&gt;for i := range 1000&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It uses &lt;code&gt;b.N&lt;/code&gt; manually instead of the modern Go 1.24 &lt;code&gt;b.Loop&lt;/code&gt; method.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Solution: Agent Rules
&lt;/h3&gt;

&lt;p&gt;To handle this, we can use &lt;strong&gt;Rules&lt;/strong&gt;. In Antigravity, a Rule is simply a Markdown file where you define constraints, stack preferences, and style guides. (See the &lt;a href="https://antigravity.google/docs/rules-workflows" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; for setup details).&lt;/p&gt;

&lt;p&gt;We can create specific rule files to "patch" the LLMs knowledge base.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Modernizing Benchmarks (benchmark.md)
&lt;/h4&gt;

&lt;p&gt;Create a file named &lt;code&gt;benchmark.md&lt;/code&gt; to instruct the agent on the new testing API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;The &lt;span class="sb"&gt;`b.Loop`&lt;/span&gt; method is now the preferred way to write benchmarks in Go 1.24+.&lt;span class="sb"&gt;


&lt;/span&gt;func BenchmarkExample(b &lt;span class="err"&gt;*&lt;/span&gt;testing.B) {
    // ... setup ...
    for b.Loop() {
        // optional timer control for in-loop setup/cleanup is handled automatically
        // ... code to measure ...
    }
    // ... cleanup ...
}

Always use b.Loop() instead of b.N in benchmarks.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Modernizing Loops (&lt;code&gt;loops.md&lt;/code&gt;)
&lt;/h4&gt;

&lt;p&gt;Create a file named &lt;code&gt;loops.md&lt;/code&gt; to enforce modern iteration syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Each iteration creates a new instance of the variable. There is no need to declare &lt;span class="sb"&gt;`v := v`&lt;/span&gt; inside the loop for closure safety.

for _, v := range data {
    go func() {
        // safe to use v here directly
    }()
}

&lt;span class="sb"&gt;`For`&lt;/span&gt; loops may now range over integers. We should use &lt;span class="sb"&gt;`for i := range 10`&lt;/span&gt; now.

for i := range 10 {
    fmt.Println(10 - i)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Result
&lt;/h3&gt;

&lt;p&gt;After creating these files, click the &lt;strong&gt;Reload Rules&lt;/strong&gt; button in the editor. Now, retry the prompt: &lt;code&gt;write benchmark for TwoSum function&lt;/code&gt; or be specific: &lt;code&gt;apply benchmark and loops rules to generate a benchmark&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You will see the Agent's implementation plan acknowledge the new context:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;[NEW] search_test.go
&lt;span class="p"&gt;*&lt;/span&gt; Create &lt;span class="sb"&gt;`search_test.go`&lt;/span&gt;.
&lt;span class="p"&gt;*&lt;/span&gt; Implement &lt;span class="sb"&gt;`BenchmarkTwoSum`&lt;/span&gt;.
&lt;span class="p"&gt;*&lt;/span&gt; Use &lt;span class="sb"&gt;`b.Loop()`&lt;/span&gt; structure.
&lt;span class="p"&gt;*&lt;/span&gt; Construct a large slice of integers and a target that is found near the end or not found to test worst/average cases.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resulting code is cleaner, modern, and follows the latest Go specs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;BenchmarkTwoSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;testing&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;B&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1997&lt;/span&gt; 

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Loop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;TwoSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Going Further: Enforcing Style Guides
&lt;/h4&gt;

&lt;p&gt;This feature is powerful because it keeps your code consistent. It forces the LLM to follow your team's rules instead of guessing or using random styles.&lt;/p&gt;

&lt;p&gt;For example, you can feed the LLM the entire &lt;a href="https://github.com/uber-go/guide" rel="noopener noreferrer"&gt;Uber Go Style Guide&lt;/a&gt;. Or use specific libraries.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Enforcing Error Wrapping &lt;code&gt;errors.md&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;If you want to ensure all errors are wrapped using cockroachdb/errors instead of standard returns or &lt;code&gt;fmt.Errorf&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Do not simply &lt;span class="sb"&gt;`return err`&lt;/span&gt;. Always wrap errors using &lt;span class="sb"&gt;`github.com/cockroachdb/errors`&lt;/span&gt; to provide stack traces and context. Use &lt;span class="sb"&gt;`Wrap(error, string)`&lt;/span&gt; or &lt;span class="sb"&gt;`Wrapf(error, string, ...interface{})`&lt;/span&gt;.

func getUser(id int) error {
    if err := someDatabaseCall(id); err != nil {
        // Wrap the original error with added context
        return errors.Wrapf(err, "some database call id %d", id)
    }&lt;span class="sb"&gt;

    return nil
&lt;/span&gt;}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is annoying when LLMs provide code that is &lt;code&gt;stuck-in-the-past&lt;/code&gt; By using &lt;code&gt;.agent/rules&lt;/code&gt; in Antigravity, you can stop fighting the LLMs old habits. Instead, you can collaborate with an Agent that understands your specific &lt;strong&gt;tools&lt;/strong&gt; and &lt;strong&gt;style&lt;/strong&gt;. Rules bridge the gap between what the LLM knows and the code you actually &lt;strong&gt;want&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>go</category>
      <category>antigravity</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
