INNER CODE UNIT · Go

getCurrentGoVersion

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

func getCurrentGoVersion() string {
	content, err := os.ReadFile("Makefile")
	if err != nil {
		log.WithError(err).Fatal("Failed to determine current version")
	}

	buildImageRe := regexp.MustCompile(`BUILD_BASE_IMAGE\s*\?=\s*golang:([0-9.]+)`)
	matches := buildImageRe.FindStringSubmatch(string(content))
	if len(matches) < 2 {
		log.Fatal("Failed to match current version in Makefile")
	}

	return matches[1]
}

func getLatestGoVersionByReleaseTrack(track string) string {
	resp, err := http.Get("https://go.dev/dl/?mode=json&include=all")
	if err != nil {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…