<?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>DEV Community: Erfan</title>
    <description>The latest articles on DEV Community by Erfan (@erfandiakoo).</description>
    <link>https://dev.to/erfandiakoo</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%2F1338360%2Fd2cefea2-7156-4ad5-b3f1-17fd9ee19c32.png</url>
      <title>DEV Community: Erfan</title>
      <link>https://dev.to/erfandiakoo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/erfandiakoo"/>
    <language>en</language>
    <item>
      <title>Tired of manually writing launch.json files in VS Code?</title>
      <dc:creator>Erfan</dc:creator>
      <pubDate>Fri, 30 May 2025 10:34:16 +0000</pubDate>
      <link>https://dev.to/erfandiakoo/tired-of-manually-writing-launchjson-files-in-vs-code-5a20</link>
      <guid>https://dev.to/erfandiakoo/tired-of-manually-writing-launchjson-files-in-vs-code-5a20</guid>
      <description>&lt;h1&gt;
  
  
  Auto-generate VS Code Debug Configurations for Go, Node.js, C#, Python
&lt;/h1&gt;

&lt;p&gt;Hey folks!&lt;/p&gt;

&lt;p&gt;I just published a simple but powerful bash script that automatically generates VS Code debug configurations for popular languages like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go&lt;/li&gt;
&lt;li&gt;Node.js&lt;/li&gt;
&lt;li&gt;C# (.NET)&lt;/li&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Just run it once and it will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detect your project’s main file&lt;/li&gt;
&lt;li&gt;Load environment variables from your &lt;code&gt;.env&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Generate a clean and ready-to-use &lt;code&gt;.vscode/launch.json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Automatically install &lt;code&gt;jq&lt;/code&gt; if missing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Super useful for solo devs, teams, and especially when setting up new projects fast.&lt;/p&gt;

&lt;p&gt;Check it out on GitHub:&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/erfandiakoo/generate-vscode-launch" rel="noopener noreferrer"&gt;https://github.com/erfandiakoo/generate-vscode-launch&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know what you think, or feel free to contribute!&lt;/p&gt;

</description>
      <category>vscode</category>
    </item>
    <item>
      <title>Get Private Packages in Go</title>
      <dc:creator>Erfan</dc:creator>
      <pubDate>Wed, 26 Mar 2025 20:07:39 +0000</pubDate>
      <link>https://dev.to/erfandiakoo/get-private-packages-in-go-321b</link>
      <guid>https://dev.to/erfandiakoo/get-private-packages-in-go-321b</guid>
      <description>&lt;p&gt;When working with private repositories in Go, fetching dependencies from private GitHub repositories requires some additional configuration. By default, &lt;code&gt;go get&lt;/code&gt; expects public repositories, but you can instruct Go to access private ones using the &lt;code&gt;GOPRIVATE&lt;/code&gt; environment variable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps to Access Private Packages
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Set the &lt;code&gt;GOPRIVATE&lt;/code&gt; Environment Variable
&lt;/h3&gt;

&lt;p&gt;This tells Go that the specified repository is private and should not be verified against &lt;code&gt;proxy.golang.org&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GOPRIVATE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;github.com/USERNAME/REPOSITORY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can add this permanently to your shell configuration file (e.g., &lt;code&gt;~/.bashrc&lt;/code&gt;, &lt;code&gt;~/.zshrc&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'export GOPRIVATE=github.com/USERNAME/REPOSITORY'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.bashrc
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Windows (PowerShell):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;System.Environment&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;SetEnvironmentVariable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"GOPRIVATE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"github.com/USERNAME/REPOSITORY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;System.EnvironmentVariableTarget&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Authenticate GitHub for Private Access
&lt;/h3&gt;

&lt;p&gt;If your repository is private, Go needs authentication to fetch it. There are two main ways to authenticate:&lt;/p&gt;

&lt;h4&gt;
  
  
  Using a Personal Access Token (PAT)
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Generate a &lt;a href="https://github.com/settings/tokens" rel="noopener noreferrer"&gt;GitHub Personal Access Token&lt;/a&gt; with &lt;code&gt;repo&lt;/code&gt; scope.&lt;/li&gt;
&lt;li&gt;Use the token in the &lt;code&gt;go get&lt;/code&gt; command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; url.&lt;span class="s2"&gt;"https://YOUR_GITHUB_USERNAME:TOKEN@github.com/"&lt;/span&gt;.insteadOf &lt;span class="s2"&gt;"https://github.com/"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures that when Go attempts to fetch the repository, it includes your credentials.&lt;/p&gt;

&lt;h4&gt;
  
  
  Using SSH Keys
&lt;/h4&gt;

&lt;p&gt;If you prefer SSH authentication:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Generate an SSH key if you haven't already:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; rsa &lt;span class="nt"&gt;-b&lt;/span&gt; 4096 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"your-email@example.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add the key to your GitHub account under &lt;code&gt;Settings &amp;gt; SSH and GPG keys&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Configure Git to use SSH:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git config &lt;span class="nt"&gt;--global&lt;/span&gt; url.&lt;span class="s2"&gt;"git@github.com:"&lt;/span&gt;.insteadOf &lt;span class="s2"&gt;"https://github.com/"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Fetch the Private Package
&lt;/h3&gt;

&lt;p&gt;Now you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go get &lt;span class="nt"&gt;-u&lt;/span&gt; github.com/USERNAME/REPOSITORY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or, if you need a specific module version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go get github.com/USERNAME/REPOSITORY@v1.2.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Verify the Module
&lt;/h3&gt;

&lt;p&gt;To ensure that the module is recognized and properly fetched, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go list &lt;span class="nt"&gt;-m&lt;/span&gt; all | &lt;span class="nb"&gt;grep &lt;/span&gt;USERNAME/REPOSITORY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Using private packages in Go requires setting &lt;code&gt;GOPRIVATE&lt;/code&gt;, configuring authentication, and ensuring your repository is accessible. Whether using PAT or SSH, these steps help you seamlessly integrate private dependencies into your Go projects.&lt;/p&gt;

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