Changes in Go 1.20.
<p>I was asked to look into Golang 1.20 to present the changes, not expecting to find much after the huge release of Go 1.18.</p>
<p>Aside from some exciting changes, I’ve also learned about many features that I wasn’t aware of before reading the release notes meticulously.</p>
<p>In order to actually show that these changes provide value, I will present issues and show how the new features solve these issues.</p>
<h2><strong>Issue 1:</strong> <strong>I want to format the date or time in a string form And it’s a hassle and error-prone.</strong></h2>
<p>I am going to write how to print out the current date:</p>
<pre>
now := time.Now()
formatted := now.Format("2007-01-02")
fmt.Println(formatted)</pre>
<p>This will print out:</p>
<pre>
21007-03-21</pre>
<p>????????</p>
<p>If you are sharp and read the code you can see I made a mistake.</p>
<p>The format is incorrect and should be: “2006–01–02" instead of “2007–01–02”.</p>
<p>Now, I never remember dates and always look it up and the cost of a mistake is huge.</p>
<p><a href="https://betterprogramming.pub/changes-in-go-1-20-b0a82d4b6c44">Read More</a></p>