INNER CODE UNIT · Go

createChangelogTemplate

projectcontour/contour · hack/actions/bump-go-version/main.go:169

func createChangelogTemplate(version string) {
	u, err := user.Current()
	if err != nil {
		log.WithError(err).Fatal("Failed to get current user")
	}

	file := fmt.Sprintf("changelogs/unreleased/nnnn-%s-small.md", u.Username)
	parts := strings.SplitN(strings.TrimPrefix(version, "go"), ".", 3)
	url := fmt.Sprintf("https://go.dev/doc/devel/release#go%s.%s.0", parts[0], parts[1])
	content := fmt.Sprintf("Updates Go to %s. See the [Go release notes](%s) for more information about the content of the release.\n", version, url)

	if err := os.WriteFile(file, []byte(content), 0o600); err != nil {
		log.WithError(err).Fatal("Failed to write changelog")
	}
	log.Infof("Created changelog template: %s", file)
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…