11package extent
22
33import (
4- "fmt"
54 "regexp"
65 "strconv"
76 "strings"
@@ -43,15 +42,16 @@ type (
4342 // It is disabled when it is empty.
4443 Review * Review `json:"review,omitempty" yaml:"review"`
4544
46- FreezeWindows []FreezeWindow `json:"freeze_windows" yaml:"freeze_windows"`
45+ // FrozenWindows is the list of windows to freeze deployments.
46+ FrozenWindows []FrozenWindow `json:"frozen_windows" yaml:"frozen_windows"`
4747 }
4848
4949 Review struct {
5050 Enabled bool `json:"enabled" yaml:"enabled"`
5151 Reviewers []string `json:"reviewers" yaml:"reviewers"`
5252 }
5353
54- FreezeWindow struct {
54+ FrozenWindow struct {
5555 Start string `json:"start" yaml:"start"`
5656 Duration string `json:"duration" yaml:"duration"`
5757 Location string `json:"location" yaml:"location"`
@@ -184,16 +184,16 @@ func (e *Env) HasReview() bool {
184184// IsFreezed verifies whether the current time is in a freeze window.
185185// It returns an error when parsing an expression is failed.
186186func (e * Env ) IsFreezed (t time.Time ) (bool , error ) {
187- if len (e .FreezeWindows ) == 0 {
187+ if len (e .FrozenWindows ) == 0 {
188188 return false , nil
189189 }
190190
191- for _ , w := range e .FreezeWindows {
191+ for _ , w := range e .FrozenWindows {
192192 s , err := cronexpr .ParseInLocation (strings .TrimSpace (w .Start ), w .Location )
193193 if err != nil {
194194 return false , eutil .NewErrorWithMessage (
195195 eutil .ErrorCodeConfigInvalid ,
196- fmt . Sprintf ( "The crontab expression of the freeze window is invalid." ) ,
196+ "The crontab expression of the freeze window is invalid." ,
197197 err ,
198198 )
199199 }
@@ -202,7 +202,7 @@ func (e *Env) IsFreezed(t time.Time) (bool, error) {
202202 if err != nil {
203203 return false , eutil .NewErrorWithMessage (
204204 eutil .ErrorCodeConfigInvalid ,
205- fmt . Sprintf ( "The duration of the freeze window is invalid." ) ,
205+ "The duration of the freeze window is invalid." ,
206206 err ,
207207 )
208208 }
0 commit comments