LWN: Comments on "What's coming in Go 1.18" https://lwn.net/Articles/883602/ This is a special feed containing comments posted to the individual LWN article titled "What's coming in Go 1.18". en-us Tue, 30 Sep 2025 10:45:13 +0000 Tue, 30 Sep 2025 10:45:13 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net What's coming in Go 1.18 https://lwn.net/Articles/884552/ https://lwn.net/Articles/884552/ blancogrande <div class="FormattedComment"> I&#x27;m as excited about workspaces as I am about generics. Anyone using a &#x27;monorepo&#x27; style development where multiple applications share libraries within the repo will be happy.<br> </div> Fri, 11 Feb 2022 17:09:39 +0000 What's coming in Go 1.18 https://lwn.net/Articles/884204/ https://lwn.net/Articles/884204/ tsavola <div class="FormattedComment"> constraints.Ordered was supposed to be shipped in the standard library (I guess it will be added in a later release). Go doesn&#x27;t support operator overloading, so only primitive types (and ~primitive types) can have the &lt; operator.<br> <p> For generic code invoking methods, you can define interfaces with methods - you don&#x27;t have to list concrete types.<br> <p> </div> Wed, 09 Feb 2022 13:19:28 +0000 What's coming in Go 1.18 https://lwn.net/Articles/884201/ https://lwn.net/Articles/884201/ Cyberax <div class="FormattedComment"> One other change that is often overlooked in 1.18 announcements is multi-module workspaces: <a href="https://go.googlesource.com/proposal/+/master/design/45713-workspace.md">https://go.googlesource.com/proposal/+/master/design/4571...</a><br> <p> This _finally_ allows to do sane local development with multiple modules, so that you don&#x27;t accidentally commit your &quot;replace&quot; directives in &quot;go.mod&quot;.<br> </div> Wed, 09 Feb 2022 12:14:48 +0000 What's coming in Go 1.18 https://lwn.net/Articles/884195/ https://lwn.net/Articles/884195/ jmaa <div class="FormattedComment"> I _think_ you can define method interfaces, which should allow full generics, but the example I found of this is a year old. [1] The linked generics tutorial doesn&#x27;t mention them, so who knows.<br> <p> [1]: <a href="https://www.freecodecamp.org/news/generics-in-golang/">https://www.freecodecamp.org/news/generics-in-golang/</a><br> </div> Wed, 09 Feb 2022 11:30:10 +0000 What's coming in Go 1.18 https://lwn.net/Articles/884183/ https://lwn.net/Articles/884183/ taladar <div class="FormattedComment"> <font class="QuotedText">&gt; func min(x float32, y float32) float32 {</font><br> <font class="QuotedText">&gt; if x &lt; y {</font><br> <font class="QuotedText">&gt; return x</font><br> <font class="QuotedText">&gt; }</font><br> <font class="QuotedText">&gt; return y</font><br> <font class="QuotedText">&gt; }</font><br> <p> <font class="QuotedText">&gt; type ordered interface {</font><br> <font class="QuotedText">&gt; float32 | float64 | int</font><br> <font class="QuotedText">&gt; }</font><br> <font class="QuotedText">&gt; func min[T ordered](x T, y T) T {</font><br> <font class="QuotedText">&gt; if x &lt; y {</font><br> <font class="QuotedText">&gt; return x</font><br> <font class="QuotedText">&gt; }</font><br> <font class="QuotedText">&gt; return y </font><br> <font class="QuotedText">&gt; }</font><br> <p> That looks like it is significantly less expressive than proper generics with open traits/type classes/interfaces/...<br> <p> Can you really only specify a closed, one-time list without being able to add new types to it later?<br> </div> Wed, 09 Feb 2022 08:45:41 +0000 What's coming in Go 1.18 https://lwn.net/Articles/884142/ https://lwn.net/Articles/884142/ Cyberax <div class="FormattedComment"> One other significant addition: &quot;~&quot; operator for constraints. You can now write: &quot;func min[T ~float32 | ~float64 | ~int](x T, y T) T&quot; meaning that T is a type that behaves like float32, float64 or int.<br> <p> </div> Tue, 08 Feb 2022 23:04:25 +0000