MCPcopy Index your code
hub / github.com/coder/coder / updateCalendar

Function updateCalendar

scripts/releaser/docs.go:164–243  ·  view source on GitHub ↗

updateCalendar modifies the calendar rows based on the new release version and channel.

(
	rows []calendarRow,
	newVer version,
	channel string,
)

Source from the content-addressed store, hash-verified

162// updateCalendar modifies the calendar rows based on the new
163// release version and channel.
164func updateCalendar(
165 rows []calendarRow,
166 newVer version,
167 channel string,
168) []calendarRow {
169 // For any release, update the "Latest Release" for the
170 // matching major.minor row.
171 for i, r := range rows {
172 if r.Major == newVer.Major && r.Minor == newVer.Minor {
173 rows[i].LatestRelease = fmt.Sprintf(
174 "[v%s](%s)",
175 newVer.String(),
176 fmt.Sprintf(releaseTagURLFmt, newVer.String()),
177 )
178 // If this row was "Not Released", update it.
179 if r.Status == "Not Released" {
180 rows[i].Status = "Mainline"
181 rows[i].ReleaseDate = time.Now().Format("January 02, 2006")
182 rows[i].ReleaseName = fmt.Sprintf(
183 "[%d.%d](%s)",
184 newVer.Major, newVer.Minor,
185 fmt.Sprintf(changelogURLFmt, newVer.Major, newVer.Minor),
186 )
187 }
188 }
189 }
190
191 // For patch releases, we only update Latest Release — done
192 // above.
193 if newVer.Patch > 0 {
194 return rows
195 }
196
197 // For new mainline releases (patch == 0), apply status
198 // transitions.
199 if channel == "mainline" {
200 for i, r := range rows {
201 switch {
202 case r.Major == newVer.Major && r.Minor == newVer.Minor:
203 // Already handled above.
204 continue
205 case r.Status == "Mainline":
206 rows[i].Status = "Stable"
207 case strings.Contains(r.Status, "Stable"):
208 // "Stable", "Stable + ESR" → Security Support.
209 rows[i].Status = "Security Support"
210 case r.Status == "Security Support":
211 rows[i].Status = "Not Supported"
212 }
213 }
214
215 // Add "Not Released" row for the next minor.
216 nextMinor := newVer.Minor + 1
217 hasNext := false
218 for _, r := range rows {
219 if r.Major == newVer.Major && r.Minor == nextMinor {
220 hasNext = true
221 break

Callers 1

updateCalendarFileFunction · 0.85

Calls 4

trimOldestNotSupportedFunction · 0.85
FormatMethod · 0.65
StringMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected