_content/doc/effective_go: update for Go 1.26 and concise warning
Move warning note to top, make it concise and include release notes link.
Update 'new' section for Go 1.26 expression arguments - strictly
speaking, this doc is frozen so we don't need to update it. But since
`new` is a language builtin so mention it.
diff --git a/_content/doc/effective_go.html b/_content/doc/effective_go.html
index 0b7389a..d54a3cf 100644
--- a/_content/doc/effective_go.html
+++ b/_content/doc/effective_go.html
@@ -4,6 +4,10 @@
"Breadcrumb": true
}-->
+<div class="Note">
+<strong>Note:</strong> This document was written for Go's release in 2009 and is not actively updated. While it remains a good guide for core language idioms, it does not cover significant changes to the ecosystem (like modules or generics) or libraries added since. For a complete list of changes, see the <a href="/doc/devel/release">release notes</a>. See <a href="/issue/28782">issue 28782</a> for context.
+</div>
+
<h2 id="introduction">Introduction</h2>
<p>
@@ -35,23 +39,7 @@
should read first.
</p>
-<p>
-Note added January, 2022:
-This document was written for Go's
-release in 2009, and has not been updated significantly since.
-Although it is a good guide to understand how to use the language
-itself, thanks to the stability of the language, it says little
-about the libraries and nothing about significant changes to the
-Go ecosystem since it was written, such as the build system, testing,
-modules, and polymorphism.
-There are no plans to update it, as so much has happened and a large
-and growing set of documents, blogs, and books do a fine job of
-describing modern Go usage.
-Effective Go continues to be useful, but the reader should
-understand it is far from a complete guide.
-See <a href="/issue/28782">issue
-28782</a> for context.
-</p>
+
<h3 id="examples">Examples</h3>
@@ -1013,6 +1001,10 @@
</p>
<p>
+Starting in Go 1.26, <code>new</code> also allows its operand to be an expression, specifying the initial value of the variable. For example, <code>new(int64(300))</code> allocates a new <code>int64</code> with value <code>300</code> and returns its address.
+</p>
+
+<p>
Since the memory returned by <code>new</code> is zeroed, it's helpful to arrange
when designing your data structures that the
zero value of each type can be used without further initialization. This means a user of
@@ -3483,6 +3475,8 @@
Go is powerful enough to make a lot happen in a few lines.
</p>
+
+
<!--
TODO
<pre>
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +2 |
Thanks for doing this. Some suggestions.
is not actively updated. While it remains a good guide for core language idioms,s/core language idioms/using the core language/
it does not cover significant changes to the ecosystem (like modules or generics)... it does not cover significant changes to the language (generics), ecosystem (modules), or libraries added since.
<code>new(T)</code> allocates zeroed storage for a new item of types/item/variable/
(because that's what it is, and it also ties the new paragraph to this paragraph.)
Starting in Go 1.26, <code>new</code> also allows its operand to be an expression, specifying the initial value of the variable. For example, <code>new(int64(300))</code> allocates a new <code>int64</code> with value <code>300</code> and returns its address.... also accepts an (value) expression as an argument, which specifies the initial ...
Starting in Go 1.26, <code>new</code> also allows its operand to be an expression, specifying the initial value of the variable. For example, <code>new(int64(300))</code> allocates a new <code>int64</code> with value <code>300</code> and returns its address.s/in/with/ (?)
Starting in Go 1.26, <code>new</code> also allows its operand to be an expression, specifying the initial value of the variable. For example, <code>new(int64(300))</code> allocates a new <code>int64</code> with value <code>300</code> and returns its address.... allocates a new variable of type <code>int64</code>, initialized to 300, and returns its address.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
is not actively updated. While it remains a good guide for core language idioms,s/core language idioms/using the core language/
Done
it does not cover significant changes to the ecosystem (like modules or generics)... it does not cover significant changes to the language (generics), ecosystem (modules), or libraries added since.
Done
<code>new(T)</code> allocates zeroed storage for a new item of types/item/variable/
(because that's what it is, and it also ties the new paragraph to this paragraph.)
Done
Starting in Go 1.26, <code>new</code> also allows its operand to be an expression, specifying the initial value of the variable. For example, <code>new(int64(300))</code> allocates a new <code>int64</code> with value <code>300</code> and returns its address.Hyang-Ah Hana Kims/in/with/ (?)
Done
Starting in Go 1.26, <code>new</code> also allows its operand to be an expression, specifying the initial value of the variable. For example, <code>new(int64(300))</code> allocates a new <code>int64</code> with value <code>300</code> and returns its address.... also accepts an (value) expression as an argument, which specifies the initial ...
Done
Starting in Go 1.26, <code>new</code> also allows its operand to be an expression, specifying the initial value of the variable. For example, <code>new(int64(300))</code> allocates a new <code>int64</code> with value <code>300</code> and returns its address.... allocates a new variable of type <code>int64</code>, initialized to 300, and returns its address.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |