@@ -21,27 +21,44 @@ import (
2121 "io"
2222 "net/http"
2323 "sort"
24+ "strings"
2425
2526 "golang.org/x/mod/semver"
2627)
2728
28- func genBoilerplate (version , shasum , goVersion string ) string {
29- return fmt .Sprintf (`load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
29+ func genBoilerplate (version , shasum , goVersion , rnotesData string ) string {
30+ trimmedVersion := strings .TrimPrefix (version , "v" )
31+ return fmt .Sprintf (`%[4]s
32+
33+ ## ` + "`MODULE.bazel`" + ` code
34+
35+ ` + "```" + `
36+ bazel_dep(name = "rules_go", version = "%[1]s")
37+
38+ go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
39+ go_sdk.download(version = "%[3]s")
40+ ` + "```" + `
41+
42+ ## ` + "`WORKSPACE`" + ` code
43+
44+ ` + "```" + `
45+ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
3046
3147http_archive(
3248 name = "io_bazel_rules_go",
3349 sha256 = "%[2]s",
3450 urls = [
35- "https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/%[1]s/rules_go-%[1]s.zip",
36- "https://github.com/bazel-contrib/rules_go/releases/download/%[1]s/rules_go-%[1]s.zip",
51+ "https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v %[1]s/rules_go-v %[1]s.zip",
52+ "https://github.com/bazel-contrib/rules_go/releases/download/v %[1]s/rules_go-v %[1]s.zip",
3753 ],
3854)
3955
4056load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
4157
4258go_rules_dependencies()
4359
44- go_register_toolchains(version = "%[3]s")` , version , shasum , goVersion )
60+ go_register_toolchains(version = "%[3]s")
61+ ` + "```\n " , trimmedVersion , shasum , goVersion , rnotesData )
4562}
4663
4764func findLatestGoVersion () (v string , err error ) {
0 commit comments