Skip to content

Commit

Permalink
golangci-lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tim1207 committed Jan 23, 2024
1 parent f7f076f commit 06ee74e
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 18 deletions.
5 changes: 2 additions & 3 deletions internal/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ type NFContext interface {

var _ NFContext = &AMFContext{}


type AMFContext struct {
EventSubscriptionIDGenerator *idgenerator.IDGenerator
EventSubscriptions sync.Map
Expand Down Expand Up @@ -564,7 +563,7 @@ func (c *AMFContext) GetTokenCtx(scope string, targetNF models.NfType) (
if !c.OAuth2Required {
return context.TODO(), nil, nil
}
return oauth.GetTokenCtx(models.NfType_AMF,targetNF,
return oauth.GetTokenCtx(models.NfType_AMF, targetNF,
c.NfId, c.NrfUri, scope)
}

Expand All @@ -576,4 +575,4 @@ func (c *AMFContext) AuthorizationCheck(token, serviceName string) error {

logger.UtilLog.Debugf("AMFContext::AuthorizationCheck: token[%s] serviceName[%s]\n", token, serviceName)
return oauth.VerifyOAuth(token, serviceName, c.NrfCertPem)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"net/http"

"github.com/gin-gonic/gin"

"github.com/free5gc/amf/internal/logger"
"github.com/free5gc/amf/internal/sbi/producer"
"github.com/free5gc/openapi"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

// N1N2MessageTransfer - Namf_Communication N1N2 Message Transfer (UE Specific) service Operation
func HTTPN1N2MessageTransfer(c *gin.Context) {

var n1n2MessageTransferRequest models.N1N2MessageTransferRequest
n1n2MessageTransferRequest.JsonData = new(models.N1N2MessageTransferReqData)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import (
func HTTPN1N2MessageSubscribe(c *gin.Context) {
var ueN1N2InfoSubscriptionCreateData models.UeN1N2InfoSubscriptionCreateData



requestBody, err := c.GetRawData()
if err != nil {
logger.CommLog.Errorf("Get Request Body error: %+v", err)
Expand Down
10 changes: 6 additions & 4 deletions internal/sbi/communication/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ import (

"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"github.com/free5gc/amf/internal/util"
"github.com/free5gc/openapi/models"

amf_context "github.com/free5gc/amf/internal/context"
"github.com/free5gc/amf/internal/logger"
"github.com/free5gc/amf/internal/util"
"github.com/free5gc/amf/pkg/factory"
"github.com/free5gc/openapi/models"
logger_util "github.com/free5gc/util/logger"
amf_context "github.com/free5gc/amf/internal/context"
)

const serviceName string = string(models.ServiceName_NAMF_COMM)

var HttpLog *logrus.Entry

func init() {
Expand Down Expand Up @@ -59,7 +61,7 @@ func AddService(engine *gin.Engine) *gin.RouterGroup {
group.Use(func(c *gin.Context) {
routerAuthorizationCheck.Check(c, amf_context.GetSelf())
})

for _, route := range routes {
switch route.Method {
case "GET":
Expand Down
5 changes: 3 additions & 2 deletions internal/sbi/eventexposure/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ import (

"github.com/gin-gonic/gin"

amf_context "github.com/free5gc/amf/internal/context"
"github.com/free5gc/amf/internal/logger"
"github.com/free5gc/amf/pkg/factory"
"github.com/free5gc/amf/internal/util"
"github.com/free5gc/amf/pkg/factory"
"github.com/free5gc/openapi/models"
logger_util "github.com/free5gc/util/logger"
amf_context "github.com/free5gc/amf/internal/context"
)

const serviceName string = string(models.ServiceName_NAMF_EVTS)

// Route is the information for every URI.
type Route struct {
// Name is the name of this Route.
Expand Down
4 changes: 2 additions & 2 deletions internal/sbi/location/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import (

"github.com/gin-gonic/gin"

amf_context "github.com/free5gc/amf/internal/context"
"github.com/free5gc/amf/internal/logger"
"github.com/free5gc/amf/pkg/factory"
"github.com/free5gc/amf/internal/util"
"github.com/free5gc/amf/pkg/factory"
"github.com/free5gc/openapi/models"
logger_util "github.com/free5gc/util/logger"
amf_context "github.com/free5gc/amf/internal/context"
)

const serviceName string = string(models.ServiceName_NAMF_LOC)
Expand Down
5 changes: 3 additions & 2 deletions internal/sbi/mt/routers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ import (

"github.com/gin-gonic/gin"

amf_context "github.com/free5gc/amf/internal/context"
"github.com/free5gc/amf/internal/logger"
"github.com/free5gc/amf/pkg/factory"
"github.com/free5gc/amf/internal/util"
"github.com/free5gc/amf/pkg/factory"
"github.com/free5gc/openapi/models"
logger_util "github.com/free5gc/util/logger"
amf_context "github.com/free5gc/amf/internal/context"
)

const serviceName string = string(models.ServiceName_NAMF_MT)

// Route is the information for every URI.
type Route struct {
// Name is the name of this Route.
Expand Down
2 changes: 1 addition & 1 deletion internal/util/router_auth_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ func (rac *RouterAuthorizationCheck) Check(c *gin.Context, amfContext amf_contex
}

logger.UtilLog.Debugf("RouterAuthorizationCheck: Check Authorized")
}
}
2 changes: 1 addition & 1 deletion internal/util/router_auth_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ func TestRouterAuthorizationCheck_Check(t *testing.T) {
}
})
}
}
}

0 comments on commit 06ee74e

Please sign in to comment.