chore: remove time validation
This commit is contained in:
parent
e1e49fb05a
commit
fce18b60cf
|
@ -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{}
|
||||
|
|
|
@ -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"`
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user