Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Adds errcheck lint check #56

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ linters:
enable:
- gofmt
# - govet
# - errcheck
- errcheck
- staticcheck
- unused
# - gosimple
Expand Down
20 changes: 16 additions & 4 deletions service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,10 @@ func getPccRules(slice *protos.NetworkSlice, sessionRule *models.SessionRule) (p
}
pccPolicy.IdGenerator = idgenerator.NewGenerator(1, math.MaxInt64)
for _, pccrule := range slice.AppFilters.PccRuleBase {
id, _ := pccPolicy.IdGenerator.Allocate()
id, err := pccPolicy.IdGenerator.Allocate()
if err != nil {
logger.GrpcLog.Errorf("IdGenerator allocation failed: %v", err)
}
var rule models.PccRule
var qos models.QosData
rule.PccRuleId = strconv.FormatInt(int64(id), 10)
Expand Down Expand Up @@ -565,7 +568,10 @@ func getPccRules(slice *protos.NetworkSlice, sessionRule *models.SessionRule) (p
var flow models.FlowInformation
flow.FlowDescription = pflow.FlowDesc
//flow.TosTrafficClass = pflow.TosTrafficClass
id, _ := pccPolicy.IdGenerator.Allocate()
id, err := pccPolicy.IdGenerator.Allocate()
if err != nil {
logger.GrpcLog.Errorf("IdGenerator allocation failed: %v", err)
}
flow.PackFiltId = strconv.FormatInt(id, 10)

if pflow.FlowDir == protos.PccFlowDirection_DOWNLINK {
Expand Down Expand Up @@ -658,7 +664,10 @@ func (pcf *PCF) UpdatePcfSubsriberPolicyData(slice *protos.NetworkSlice) {
make(map[string]*models.QosData), make(map[string]*models.TrafficControlData),
make(map[string]*context.SessionPolicy), nil}
policyData.PccPolicy[sliceid].SessionPolicy[dnn] = &context.SessionPolicy{make(map[string]*models.SessionRule), idgenerator.NewGenerator(1, math.MaxInt16)}
id, _ := policyData.PccPolicy[sliceid].SessionPolicy[dnn].SessionRuleIdGenerator.Allocate()
id, err := policyData.PccPolicy[sliceid].SessionPolicy[dnn].SessionRuleIdGenerator.Allocate()
if err != nil {
logger.GrpcLog.Errorf("SessionRuleIdGenerator allocation failed: %v", err)
}
//tcid, _ := policyData.PccPolicy[sliceid].TcIdGenerator.Allocate()
sessionrule.SessRuleId = dnn + "-" + strconv.Itoa(int(id))
policyData.PccPolicy[sliceid].SessionPolicy[dnn].SessionRules[sessionrule.SessRuleId] = sessionrule
Expand Down Expand Up @@ -702,7 +711,10 @@ func (pcf *PCF) UpdatePcfSubsriberPolicyData(slice *protos.NetworkSlice) {
policyData.PccPolicy[sliceid].SessionPolicy[dnn] = &context.SessionPolicy{make(map[string]*models.SessionRule), idgenerator.NewGenerator(1, math.MaxInt16)}

//Added session rules
id, _ := policyData.PccPolicy[sliceid].SessionPolicy[dnn].SessionRuleIdGenerator.Allocate()
id, err := policyData.PccPolicy[sliceid].SessionPolicy[dnn].SessionRuleIdGenerator.Allocate()
if err != nil {
logger.GrpcLog.Errorf("SessionRuleIdGenerator allocation failed: %v", err)
}
sessionrule.SessRuleId = dnn + strconv.Itoa(int(id))
policyData.PccPolicy[sliceid].SessionPolicy[dnn].SessionRules[sessionrule.SessRuleId] = sessionrule
//Added pcc rules
Expand Down
Loading