From fce18b60cf079dac246545e9835808ad48b35add Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Sun, 14 Sep 2025 17:53:25 -0700 Subject: [PATCH] chore: remove time validation --- cmd/joj3/conf/conf.go | 14 -------------- cmd/joj3/conf/model.go | 12 +++++------- cmd/joj3/main.go | 11 ----------- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/cmd/joj3/conf/conf.go b/cmd/joj3/conf/conf.go index c9b47fd..13f9a21 100644 --- a/cmd/joj3/conf/conf.go +++ b/cmd/joj3/conf/conf.go @@ -13,7 +13,6 @@ import ( "path/filepath" "regexp" "strings" - "time" "github.com/go-git/go-git/v5" "github.com/koding/multiconfig" @@ -179,19 +178,6 @@ func GetConfPath(confRoot, confName, fallbackConfName, msg, tag string) ( return } -func CheckValid(conf *Conf) error { - now := time.Now().Unix() - if conf.EffectiveUnixTimestamp > 0 && - conf.EffectiveUnixTimestamp > now { - return fmt.Errorf("config file not effective now: %d", now) - } - if conf.ExpireUnixTimestamp > 0 && - conf.ExpireUnixTimestamp < now { - return fmt.Errorf("config file expired now: %d", now) - } - return nil -} - func MatchGroups(conf *Conf, conventionalCommit *ConventionalCommit) []string { seen := make(map[string]bool) keywords := []string{} diff --git a/cmd/joj3/conf/model.go b/cmd/joj3/conf/model.go index ae5e33e..230b021 100644 --- a/cmd/joj3/conf/model.go +++ b/cmd/joj3/conf/model.go @@ -21,13 +21,11 @@ type ConfStage struct { } type Conf struct { - Name string `default:"unknown"` - LogPath string `default:""` - ActorCsvPath string `default:""` - EffectiveUnixTimestamp int64 `default:"-1"` - ExpireUnixTimestamp int64 `default:"-1"` - MaxTotalScore int `default:"-1"` - Stage struct { + Name string `default:"unknown"` + LogPath string `default:""` + ActorCsvPath string `default:""` + MaxTotalScore int `default:"-1"` + Stage struct { SandboxExecServer string `default:"localhost:5051"` SandboxToken string `default:""` OutputPath string `default:"joj3_result.json"` diff --git a/cmd/joj3/main.go b/cmd/joj3/main.go index 07d3c63..d108ad9 100644 --- a/cmd/joj3/main.go +++ b/cmd/joj3/main.go @@ -92,14 +92,6 @@ func showConfStat(confPath string, confStat fs.FileInfo) error { return nil } -func validateConf(conf *joj3Conf.Conf) error { - if err := joj3Conf.CheckValid(conf); err != nil { - slog.Error("conf not valid now", "error", err) - return err - } - return nil -} - func run(conf *joj3Conf.Conf, conventionalCommit *joj3Conf.ConventionalCommit) error { groups := joj3Conf.MatchGroups(conf, conventionalCommit) env.SetGroups(strings.Join(groups, ",")) @@ -143,9 +135,6 @@ func mainImpl() (err error) { if err := setupSlog(conf); err != nil { return err } - if err := validateConf(conf); err != nil { - return err - } if err := run(conf, conventionalCommit); err != nil { return err }