aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2025-03-01 17:02:26 -0500
committerGopher Robot <gobot@golang.org>2025-03-03 08:36:17 -0800
commit8b2902f950802f3da01f9eb53daaf15de7639fc0 (patch)
tree3630f9dc71df9cce2cf260814742eabbe8e0948b /cmd
parenta04b3c9a44e341b927adf16dc1a380b7d6a388a1 (diff)
downloadgo-x-website-8b2902f950802f3da01f9eb53daaf15de7639fc0.tar.xz
_content/doc/go1.24: add release date
The month and year alone should be enough granularity for the purpose of the introduction to Go 1.24. In this case, February 2025 refers to when the go1.24.0 major release came out, but we released pre-release versions even before then. Link to the dedicated release history page where full details and exact dates can be found. Add a test so we don't forget. For golang/go#68545. Fixes golang/go#54170. Change-Id: Ia2bceee9208094b0623add6696585592f4399893 Reviewed-on: https://go-review.googlesource.com/c/website/+/654015 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/golangorg/server_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/cmd/golangorg/server_test.go b/cmd/golangorg/server_test.go
index 649c50f9..d796edb4 100644
--- a/cmd/golangorg/server_test.go
+++ b/cmd/golangorg/server_test.go
@@ -8,6 +8,7 @@ import (
"bytes"
"fmt"
"go/build"
+ "io/fs"
"net/http/httptest"
"net/url"
"os"
@@ -18,6 +19,8 @@ import (
"testing"
"golang.org/x/net/html"
+ "golang.org/x/website"
+ "golang.org/x/website/internal/history"
"golang.org/x/website/internal/webtest"
)
@@ -319,3 +322,30 @@ func findAttr(n *html.Node, name string) string {
}
return ""
}
+
+// TestReleaseNotesHaveDate tests that release notes
+// include the date of the corresponding major release.
+// See go.dev/issue/54170.
+func TestReleaseNotesHaveDate(t *testing.T) {
+ for _, r := range history.Majors {
+ if r.Version.Before(history.Version{X: 1, Y: 24}) {
+ // No dates in release notes before Go 1.24.
+ break
+ }
+ maj := r.Version.MajorPrefix()
+ t.Run(maj, func(t *testing.T) {
+ name := fmt.Sprintf("doc/go%s.md", maj)
+ have, err := fs.ReadFile(website.Content(), name)
+ if err != nil {
+ t.Fatalf("Go %s release notes (_content/%s) can't be read: %v", maj, name, err)
+ }
+ want := fmt.Sprintf("[%s %d](/doc/devel/release#go%s)", r.Date.Month, r.Date.Year, r.Version)
+ if r.Future {
+ want = fmt.Sprintf("%s %d", r.Date.Month, r.Date.Year)
+ }
+ if !strings.Contains(string(have), want) {
+ t.Errorf("Go %s release notes (_content/%s) doesn't contain the release date and link to release history page %q", maj, name, want)
+ }
+ })
+ }
+}