refactor: remove backward compatibility fields
This commit is contained in:
parent
be12f79a4e
commit
64bc267300
|
|
@ -208,13 +208,6 @@ func MatchGroups(conf *Conf, conventionalCommit *ConventionalCommit) []string {
|
|||
confStages = append(confStages, conf.Stages...)
|
||||
confStages = append(confStages, conf.PostStages...)
|
||||
for _, stage := range confStages {
|
||||
if stage.Group != "" {
|
||||
keyword := strings.ToLower(stage.Group)
|
||||
if _, exists := seen[keyword]; !exists {
|
||||
seen[keyword] = true
|
||||
keywords = append(keywords, keyword)
|
||||
}
|
||||
}
|
||||
if len(stage.Groups) > 0 {
|
||||
for _, group := range stage.Groups {
|
||||
keyword := strings.ToLower(group)
|
||||
|
|
@ -235,15 +228,12 @@ func MatchGroups(conf *Conf, conventionalCommit *ConventionalCommit) []string {
|
|||
slog.Info("matched groups", "groups", groups)
|
||||
if matchAllGroups {
|
||||
for i := range conf.PreStages {
|
||||
conf.PreStages[i].Group = ""
|
||||
conf.PreStages[i].Groups = nil
|
||||
}
|
||||
for i := range conf.Stages {
|
||||
conf.Stages[i].Group = ""
|
||||
conf.Stages[i].Groups = nil
|
||||
}
|
||||
for i := range conf.PostStages {
|
||||
conf.PostStages[i].Group = ""
|
||||
conf.PostStages[i].Groups = nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import (
|
|||
|
||||
type ConfStage struct {
|
||||
Name string
|
||||
Group string // TODO: remove Group in the future
|
||||
Groups []string
|
||||
Executor struct {
|
||||
Name string
|
||||
|
|
@ -31,15 +30,6 @@ type Conf struct {
|
|||
PreStages []ConfStage
|
||||
Stages []ConfStage
|
||||
PostStages []ConfStage
|
||||
// TODO: remove this nested struct
|
||||
Stage struct {
|
||||
SandboxExecServer string
|
||||
SandboxToken string
|
||||
OutputPath string
|
||||
PreStages []ConfStage
|
||||
Stages []ConfStage
|
||||
PostStages []ConfStage
|
||||
}
|
||||
}
|
||||
|
||||
type OptionalCmd struct {
|
||||
|
|
|
|||
|
|
@ -78,31 +78,6 @@ func loadConf(confPath string) (*joj3Conf.Conf, error) {
|
|||
slog.Error("parse conf", "error", err)
|
||||
return nil, err
|
||||
}
|
||||
// TODO: remove this compatible code for nested struct
|
||||
if conf.Stage.SandboxExecServer != "" {
|
||||
conf.SandboxExecServer = conf.Stage.SandboxExecServer
|
||||
conf.Stage.SandboxExecServer = ""
|
||||
}
|
||||
if conf.Stage.SandboxToken != "" {
|
||||
conf.SandboxToken = conf.Stage.SandboxToken
|
||||
conf.Stage.SandboxToken = ""
|
||||
}
|
||||
if conf.Stage.OutputPath != "" {
|
||||
conf.OutputPath = conf.Stage.OutputPath
|
||||
conf.Stage.OutputPath = ""
|
||||
}
|
||||
if len(conf.Stage.PreStages) > 0 {
|
||||
conf.PreStages = conf.Stage.PreStages
|
||||
conf.Stage.PreStages = nil
|
||||
}
|
||||
if len(conf.Stage.Stages) > 0 {
|
||||
conf.Stages = conf.Stage.Stages
|
||||
conf.Stage.Stages = nil
|
||||
}
|
||||
if len(conf.Stage.PostStages) > 0 {
|
||||
conf.PostStages = conf.Stage.PostStages
|
||||
conf.Stage.PostStages = nil
|
||||
}
|
||||
slog.Debug("conf loaded", "conf", conf, "joj3 version", Version)
|
||||
return conf, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,21 +44,13 @@ func generateStages(confStages []conf.ConfStage, groups []string) (
|
|||
stages := []stage.Stage{}
|
||||
existNames := map[string]bool{}
|
||||
for i, s := range confStages {
|
||||
if len(groups) == 0 && (len(s.Groups) != 0 || s.Group != "") {
|
||||
if len(groups) == 0 && (len(s.Groups) != 0) {
|
||||
continue
|
||||
}
|
||||
ok := false
|
||||
if s.Group == "" && len(s.Groups) == 0 {
|
||||
if len(s.Groups) == 0 {
|
||||
ok = true
|
||||
}
|
||||
if !ok && s.Group != "" {
|
||||
for _, group := range groups {
|
||||
if strings.EqualFold(group, s.Group) {
|
||||
ok = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if !ok && len(s.Groups) > 0 {
|
||||
for _, group := range groups {
|
||||
for _, g := range s.Groups {
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -139,8 +139,6 @@ gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
|||
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2 h1:2I6GHUeJ/4shcDpoUlLs/2WPnhg7yJwvXtqcMJt9liA=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251213004720-97cd9d5aeac2/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
|
||||
google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY=
|
||||
google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
|
||||
google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE=
|
||||
google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
|
||||
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user