<?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: hzoltan</title>
    <description>The latest articles on DEV Community by hzoltan (@hzoltan).</description>
    <link>https://dev.to/hzoltan</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%2F674351%2F0fc7e142-546d-41ce-869a-7035b5739b02.jpeg</url>
      <title>DEV Community: hzoltan</title>
      <link>https://dev.to/hzoltan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hzoltan"/>
    <language>en</language>
    <item>
      <title>What is an idempotent function?</title>
      <dc:creator>hzoltan</dc:creator>
      <pubDate>Sat, 14 Aug 2021 16:40:39 +0000</pubDate>
      <link>https://dev.to/hzoltan/what-is-an-idempotent-function-2hkn</link>
      <guid>https://dev.to/hzoltan/what-is-an-idempotent-function-2hkn</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjp6aar16fxdv6z82m697.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjp6aar16fxdv6z82m697.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;idempotent&lt;/strong&gt; function in computing is a function that you call more than once with the same input parameters, it will have no additional effect.&lt;/p&gt;

&lt;p&gt;It comes from mathematics which looks like this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;f(f(x)) = f(x)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's let's check an example in Go!&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;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"strings"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;definition&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s"&gt;"iDeMpoTeNt"&lt;/span&gt;

    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strings&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ToUpper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;definition&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c"&gt;// f(x)&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;definition&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strings&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ToUpper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strings&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ToUpper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;definition&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt; &lt;span class="c"&gt;// f(f(x))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


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

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

// Output:
IDEMPOTENT
iDeMpoTeNt
IDEMPOTENT


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

&lt;/div&gt;

&lt;p&gt;by calling &lt;code&gt;strings.ToUpper()&lt;/code&gt; on &lt;code&gt;definition&lt;/code&gt; variable at first, it will make it uppercase. But calling it again &lt;strong&gt;with "definition"&lt;/strong&gt; makes no other additional effects, therefore it is &lt;strong&gt;idempotent&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;You can try it yourself on &lt;a href="https://play.golang.org/p/bJIH6u0wLBr" rel="noopener noreferrer"&gt;the Go Playground!&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Update: Why &lt;strong&gt;idempotency&lt;/strong&gt; is useful?
&lt;/h2&gt;

&lt;p&gt;Special thanks to &lt;a href="https://dev.to/cappe987"&gt;Casper&lt;/a&gt; in the &lt;a href="https://dev.to/cappe987/comment/1h81k"&gt;comment&lt;/a&gt; for sharing a great 15 min long &lt;a href="//lispcast.com/what-is-idempotence/"&gt;podcast&lt;/a&gt; from Eric Normand about idempotence and why it is useful. I think he had an example rich explanation, and it's best for you to listen to his words!&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>theory</category>
      <category>go</category>
    </item>
    <item>
      <title>Go: Provide automated tested examples for your documentation!</title>
      <dc:creator>hzoltan</dc:creator>
      <pubDate>Fri, 13 Aug 2021 07:02:40 +0000</pubDate>
      <link>https://dev.to/hzoltan/go-tested-documentation-1cbm</link>
      <guid>https://dev.to/hzoltan/go-tested-documentation-1cbm</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR:
&lt;/h2&gt;

&lt;p&gt;You can provide example usage of your code which will be tested with &lt;code&gt;go test -v&lt;/code&gt;. Imagine you have this really cool function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// YourFunction will return "good output" no matter what.
func YourFunction(someInput string) string {
    return "good output"
}

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

&lt;/div&gt;



&lt;p&gt;Add a function in your package's &lt;code&gt;_test.go&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func ExampleYourFunction() {
    result := YourFunction("some input")
    fmt.Println(result)
    // Output: wrong output
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the &lt;code&gt;Example*&lt;/code&gt; prefix of the function name. Now if you run &lt;code&gt;go test -v&lt;/code&gt; it should break, because the output is wrong!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go test -v

=== RUN   ExampleYourFunction
--- FAIL: ExampleYourFunction (0.00s)
got:
good output
want:
wrong output
FAIL
exit status 1
FAIL    example        0.978s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now change it to "good output":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func ExampleYourFunction() {
    result := YourFunction("some input")
    fmt.Println(result)
    // Output: good output
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now run it again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go test -v       
=== RUN   ExampleYourFunction
--- PASS: ExampleYourFunction (0.00s)
PASS
ok      integers        0.366s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yey!&lt;/p&gt;

&lt;h2&gt;
  
  
  Detailed explanation
&lt;/h2&gt;

&lt;p&gt;You can provide examples for your code which will be tested, you can see it with &lt;code&gt;go test -v&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new directory &lt;code&gt;integers&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir integers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Init our new go module (not required)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go mod init integers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create a new file &lt;code&gt;integers.go&lt;/code&gt;
and put this function inside which we will test (I recommend you to type it instead of copy just for the sake of exercising your muscle memory)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package integers

// Multiply takes two integers and returns their product
func Multiply(x, y int) int {
    return x * y
}

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Examples are living along with the automated tests in the &lt;code&gt;_test&lt;/code&gt; file, create a new &lt;code&gt;integers_test.go&lt;/code&gt; file and type your example for the function:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package integers

import (
    "fmt"
)

func ExampleMultiply() {
    product := Multiply(3, 3)
    fmt.Println(product)
    // Output: 8
}

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;You may already noticed but the &lt;code&gt;// Output: 8&lt;/code&gt; is not the result this function will return, this is exactly what we wanted: &lt;strong&gt;to have something that breaks.&lt;/strong&gt; Let's check it ourselves:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go test -v
=== RUN   ExampleMultiply
--- FAIL: ExampleMultiply (0.00s)
got:
9
want:
8
FAIL
exit status 1
FAIL    integers        0.878s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We intentionally implemented it in a way to &lt;strong&gt;actually see it fail&lt;/strong&gt;, but normally after a refactor you simply run your tests and &lt;code&gt;go test&lt;/code&gt; will take care about the &lt;em&gt;examples&lt;/em&gt; you provided. Now let's correct our mistake!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fix the output and run your tests again:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func ExampleMultiply() {
    product := Multiply(3, 3)
    fmt.Println(product)
    // Output: 9
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go test -v
=== RUN   ExampleMultiply
--- PASS: ExampleMultiply (0.00s)
PASS
ok      integers        0.880s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Now let's see how does this look in the documentation. Run godoc to see it troubleshooting:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ godoc -http :8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now navigate to the documentation: &lt;a href="http://localhost:8000/pkg/integers/" rel="noopener noreferrer"&gt;http://localhost:8000/pkg/integers/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuswngzyd29cq52rtga4x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuswngzyd29cq52rtga4x.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Amazing! Right? You have an example which is also a test, and  even if you intentionally implement API breaking changes (which we obviously try to avoid) than &lt;strong&gt;you will see that you have to change your documentation.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  I hope you enjoyed it! Here are the sources:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;I learned this from the &lt;a href="https://quii.gitbook.io/learn-go-with-tests/go-fundamentals/iteration" rel="noopener noreferrer"&gt;Learn go with tests&lt;/a&gt; book, I highly recommend to read it!&lt;/li&gt;
&lt;li&gt;If you are interested in more detailed examples, check &lt;a href="https://blog.golang.org/examples" rel="noopener noreferrer"&gt;The Go Blog: Testable Examples in Go&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Troubleshooting
&lt;/h3&gt;

&lt;p&gt;In Go 1.14+ godoc is no longer included, you may have to install it directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go get golang.org/x/tools/cmd/godoc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>go</category>
      <category>testing</category>
      <category>documentation</category>
    </item>
    <item>
      <title>Solution to html/template: "your-template.tmpl" is undefined
</title>
      <dc:creator>hzoltan</dc:creator>
      <pubDate>Thu, 05 Aug 2021 23:43:34 +0000</pubDate>
      <link>https://dev.to/hzoltan/solution-to-html-template-your-template-tmpl-is-undefined-4aen</link>
      <guid>https://dev.to/hzoltan/solution-to-html-template-your-template-tmpl-is-undefined-4aen</guid>
      <description>&lt;h1&gt;
  
  
  TL;DR
&lt;/h1&gt;

&lt;p&gt;First I thought when I execute a template I'm using relative filepath, but I was wrong because it actually using template name, which is the base file name (without the directory).&lt;/p&gt;

&lt;h1&gt;
  
  
  Longer explanation
&lt;/h1&gt;

&lt;p&gt;While following the awesome &lt;a href="https://golang.org/doc/articles/wiki/"&gt;Golang wiki page assignment&lt;/a&gt;, I had hard time with putting the template files into a subdirectory and make them work.&lt;/p&gt;

&lt;p&gt;If you are here, you might have some of the following directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;├── IAmNew.txt
├── TestPage.txt
├── go.mod
├── tmpl
│   ├── page-edit.html
│   └── page-view.html
└── wiki.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And you have something similar code to 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;var&lt;/span&gt; &lt;span class="n"&gt;templates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;template&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Must&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;template&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ParseGlob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"./tmpl/*.html"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or maybe you used the ParseFiles and have a list of files instead:&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;var&lt;/span&gt; &lt;span class="n"&gt;templates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;template&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Must&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;template&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ParseGlob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"tmpl/page-view.html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"tmpl/page-edit.html"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚠️ Wrong way of executing templates&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="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;templates&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ExecuteTemplate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"tmpl/"&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;tmpl&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s"&gt;".html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ I removed the directory prefix and it worked&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="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;templates&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ExecuteTemplate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tmpl&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s"&gt;".html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Explanation from the documentation itself
&lt;/h2&gt;

&lt;p&gt;ParseFiles creates a new Template and parses the template definitions from the named files. &lt;strong&gt;The returned template's name will have the (base) name&lt;/strong&gt; and (parsed) contents of the first file. There must be at least one file.&lt;br&gt;
If an error occurs, parsing stops and the returned *Template is nil.&lt;/p&gt;

&lt;h2&gt;
  
  
  Also another possible reason could be
&lt;/h2&gt;

&lt;p&gt;When parsing multiple files with the same name in different directories, the last one mentioned will be the one that results. For instance, ParseFiles("a/foo", "b/foo") stores "b/foo" as the template named "foo", while "a/foo" is unavailable.&lt;/p&gt;

</description>
      <category>go</category>
      <category>template</category>
    </item>
    <item>
      <title>Check if go package installed + "uninstall go package"</title>
      <dc:creator>hzoltan</dc:creator>
      <pubDate>Thu, 29 Jul 2021 23:06:41 +0000</pubDate>
      <link>https://dev.to/hzoltan/go-install-4cke</link>
      <guid>https://dev.to/hzoltan/go-install-4cke</guid>
      <description>&lt;p&gt;In a directory where there is a go.mod file, you can discover the install path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go list -f '{{.Target}}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I don't come up with this, just found it at &lt;a href="https://golang.org/doc/tutorial/compile-install"&gt;https://golang.org/doc/tutorial/compile-install&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;One liner:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go list -f '{{.Target}}' | if xargs ls -la &amp;amp;&amp;gt; /dev/null ; then echo "Installed"; else echo "Not installed"; fi
// Outputs "Installed" or "Not installed"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go clean -i
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>go</category>
    </item>
    <item>
      <title>hola mundo</title>
      <dc:creator>hzoltan</dc:creator>
      <pubDate>Mon, 26 Jul 2021 13:02:08 +0000</pubDate>
      <link>https://dev.to/hzoltan/hola-mundo-2ahd</link>
      <guid>https://dev.to/hzoltan/hola-mundo-2ahd</guid>
      <description>&lt;p&gt;just like every starting posts: I'm really excited to start my first developer journal!&lt;/p&gt;

&lt;p&gt;Well I'm here to keep track of the stuff I found or eventually will find interesting.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
