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 go vet analyzers in CI #47

Merged
merged 7 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 2 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,8 @@ linters-settings:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
# enable or disable analyzers by name
enable:
- atomicalign
enable-all: false
disable:
- shadow
disable-all: false
# enable all analyzers
enable-all: true
depguard:
list-type: blacklist
include-go-root: false
Expand Down
2 changes: 1 addition & 1 deletion context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ type NSSFContext struct {
RegisterIPv4 string
// HttpIpv6Address string
patriciareinoso marked this conversation as resolved.
Show resolved Hide resolved
BindingIPv4 string
SBIPort int
NfService map[models.ServiceName]models.NfService
NrfUri string
SupportedPlmnList []models.PlmnId
SBIPort int
}

// Initialize NSSF context with configuration factory
Expand Down
4 changes: 2 additions & 2 deletions factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const (
type Config struct {
Info *Info `yaml:"info"`
Configuration *Configuration `yaml:"configuration"`
Subscriptions []Subscription `yaml:"subscriptions,omitempty"`
Logger *logger_util.Logger `yaml:"logger"`
Subscriptions []Subscription `yaml:"subscriptions,omitempty"`
}

type Info struct {
Expand Down Expand Up @@ -100,8 +100,8 @@ type MappingFromPlmnConfig struct {
}

type Subscription struct {
SubscriptionId string `yaml:"subscriptionId"`
SubscriptionData *models.NssfEventSubscriptionCreateData `yaml:"subscriptionData"`
SubscriptionId string `yaml:"subscriptionId"`
}

var ConfigPodTrigger chan bool
Expand Down
10 changes: 5 additions & 5 deletions producer/nssaiavailability_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func NSSAIAvailabilityDeleteProcedure(nfId string) *models.ProblemDetails {
}
}

*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.UNSUPPORTED_RESOURCE,
Status: http.StatusNotFound,
Detail: fmt.Sprintf("AMF ID '%s' does not exist", nfId),
Expand Down Expand Up @@ -87,7 +87,7 @@ func NSSAIAvailabilityPatchProcedure(nssaiAvailabilityUpdateInfo plugin.PatchDoc
}
factory.ConfigLock.RUnlock()
if !hitAmf {
*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.UNSUPPORTED_RESOURCE,
Status: http.StatusNotFound,
Detail: fmt.Sprintf("AMF ID '%s' does not exist", nfId),
Expand All @@ -114,7 +114,7 @@ func NSSAIAvailabilityPatchProcedure(nssaiAvailabilityUpdateInfo plugin.PatchDoc

patch, err := jsonpatch.DecodePatch(patchJSON)
if err != nil {
*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.MALFORMED_REQUEST,
Status: http.StatusBadRequest,
Detail: err.Error(),
Expand All @@ -124,7 +124,7 @@ func NSSAIAvailabilityPatchProcedure(nssaiAvailabilityUpdateInfo plugin.PatchDoc

modified, err := patch.Apply(original)
if err != nil {
*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.INVALID_REQUEST,
Status: http.StatusConflict,
Detail: err.Error(),
Expand All @@ -136,7 +136,7 @@ func NSSAIAvailabilityPatchProcedure(nssaiAvailabilityUpdateInfo plugin.PatchDoc
err = json.Unmarshal(modified, &factory.NssfConfig.Configuration.AmfList[amfIdx].SupportedNssaiAvailabilityData)
factory.ConfigLock.Unlock()
if err != nil {
*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.INVALID_REQUEST,
Status: http.StatusBadRequest,
Detail: err.Error(),
Expand Down
4 changes: 2 additions & 2 deletions producer/nssaiavailability_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NSSAIAvailabilityPostProcedure(createData models.NssfEventSubscriptionCreat
if err != nil {
logger.Nssaiavailability.Warnf(err.Error())

*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.UNSUPPORTED_RESOURCE,
Status: http.StatusNotFound,
Detail: err.Error(),
Expand Down Expand Up @@ -99,7 +99,7 @@ func NSSAIAvailabilityUnsubscribeProcedure(subscriptionId string) *models.Proble
}

// No specific subscription ID exists
*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.UNSUPPORTED_RESOURCE,
Status: http.StatusNotFound,
Detail: fmt.Sprintf("Subscription ID '%s' is not available", subscriptionId),
Expand Down
9 changes: 1 addition & 8 deletions producer/subscription_id_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

"github.com/omec-project/http_wrapper"
"github.com/omec-project/nssf/logger"
"github.com/omec-project/openapi/models"
)

// HandleNSSAIAvailabilityUnsubscribe - Deletes an already existing NSSAI availability notification subscription
Expand All @@ -32,12 +31,6 @@ func HandleNSSAIAvailabilityUnsubscribe(request *http_wrapper.Request) *http_wra

if problemDetails == nil {
return http_wrapper.NewResponse(http.StatusNoContent, nil, nil)
} else if problemDetails != nil {
return http_wrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
}
problemDetails = &models.ProblemDetails{
Status: http.StatusForbidden,
Cause: "UNSPECIFIED",
}
return http_wrapper.NewResponse(http.StatusForbidden, nil, problemDetails)
return http_wrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
gab-arrobo marked this conversation as resolved.
Show resolved Hide resolved
}
6 changes: 2 additions & 4 deletions test/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ type TestingUtil struct {
}

type TestingNsselection struct {
ConfigFile string

GenerateNonRoamingQueryParameter func() NsselectionQueryParameter

GenerateRoamingQueryParameter func() NsselectionQueryParameter
GenerateRoamingQueryParameter func() NsselectionQueryParameter
ConfigFile string
}

type TestingNssaiavailability struct {
Expand Down
Loading