Skip to content

Commit

Permalink
Merge pull request #32 from andy89923/chore/bump-ci-version
Browse files Browse the repository at this point in the history
Chore: Bump Golang to 1.21 and CI version
  • Loading branch information
ianchen0119 authored Apr 17, 2024
2 parents 47dc3ed + 0173214 commit 15ca270
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.18', '1.21' ]
go: [ '1.21' ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.18' ]
go: [ '1.21' ]
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.45.2
version: v1.57.2

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/free5gc/n3iwf

go 1.17
go 1.21

require (
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
Expand Down
2 changes: 1 addition & 1 deletion internal/ngap/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ func handlePDUSessionResourceModifyRequestTransfer(
}

responseTransfer = unsuccessfulTransfer
return
return success, responseTransfer
}

if ulNGUUPTNLModifyList != nil {
Expand Down
6 changes: 3 additions & 3 deletions internal/ngap/message/3gpp_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func UnmarshalEAP5GData(codedData []byte) (anParameters *ANParameters, nasPDU []
guamiField = append(guamiField, parameterValue...)
// Decode GUAMI using aper
ngapGUAMI := new(ngapType.GUAMI)
err := aper.UnmarshalWithParams(guamiField, ngapGUAMI, "valueExt")
err = aper.UnmarshalWithParams(guamiField, ngapGUAMI, "valueExt")
if err != nil {
logger.NgapLog.Errorf("APER unmarshal with parameter failed: %+v", err)
return nil, nil, errors.New("Unmarshal failed when decoding GUAMI")
Expand Down Expand Up @@ -109,7 +109,7 @@ func UnmarshalEAP5GData(codedData []byte) (anParameters *ANParameters, nasPDU []
plmnField = append(plmnField, parameterValue...)
// Decode PLMN using aper
ngapPLMN := new(ngapType.PLMNIdentity)
err := aper.UnmarshalWithParams(plmnField, ngapPLMN, "valueExt")
err = aper.UnmarshalWithParams(plmnField, ngapPLMN, "valueExt")
if err != nil {
logger.NgapLog.Errorf("APER unmarshal with parameter failed: %v", err)
return nil, nil, errors.New("Unmarshal failed when decoding PLMN")
Expand Down Expand Up @@ -275,7 +275,7 @@ func UnmarshalEAP5GData(codedData []byte) (anParameters *ANParameters, nasPDU []
return nil, nil, errors.New("Error formatting")
}

return
return anParameters, nasPDU, err
} else {
return nil, nil, errors.New("No data to decode")
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"math"
"math/big"
"net"
"os"
"strings"
"sync"

Expand Down Expand Up @@ -178,7 +178,7 @@ func InitN3IWFContext() bool {
keyPath = factory.N3iwfConfig.Configuration.PrivateKey
}

content, err := ioutil.ReadFile(keyPath)
content, err := os.ReadFile(keyPath)
if err != nil {
logger.CtxLog.Errorf("Cannot read private key data from file: %+v", err)
return false
Expand Down Expand Up @@ -220,7 +220,7 @@ func InitN3IWFContext() bool {
}

// Read .pem
content, err := ioutil.ReadFile(keyPath)
content, err := os.ReadFile(keyPath)
if err != nil {
logger.CtxLog.Errorf("Cannot read certificate authority data from file: %+v", err)
return false
Expand Down Expand Up @@ -259,7 +259,7 @@ func InitN3IWFContext() bool {
}

// Read .pem
content, err := ioutil.ReadFile(keyPath)
content, err := os.ReadFile(keyPath)
if err != nil {
logger.CtxLog.Errorf("Cannot read certificate data from file: %+v", err)
return false
Expand Down
4 changes: 2 additions & 2 deletions pkg/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package factory

import (
"fmt"
"io/ioutil"
"os"

"github.com/asaskevich/govalidator"
yaml "gopkg.in/yaml.v2"
Expand All @@ -23,7 +23,7 @@ func InitConfigFactory(f string, cfg *Config) error {
f = N3iwfDefaultConfigPath
}

if content, err := ioutil.ReadFile(f); err != nil {
if content, err := os.ReadFile(f); err != nil {
return fmt.Errorf("[Factory] %+v", err)
} else {
logger.CfgLog.Infof("Read config from [%s]", f)
Expand Down
9 changes: 4 additions & 5 deletions pkg/ike/handler/3gpp_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func UnmarshalEAP5GData(codedData []byte) (eap5GMessageID uint8, anParameters *A
eap5GMessageID = codedData[0]
logger.IKELog.Debugf("Message-Id: %d", eap5GMessageID)
if eap5GMessageID == message.EAP5GType5GStop {
return
return eap5GMessageID, anParameters, nasPDU, err
}

codedData = codedData[2:]
Expand Down Expand Up @@ -83,7 +83,7 @@ func UnmarshalEAP5GData(codedData []byte) (eap5GMessageID uint8, anParameters *A
guamiField = append(guamiField, parameterValue...)
// Decode GUAMI using aper
ngapGUAMI := new(ngapType.GUAMI)
err := aper.UnmarshalWithParams(guamiField, ngapGUAMI, "valueExt")
err = aper.UnmarshalWithParams(guamiField, ngapGUAMI, "valueExt")
if err != nil {
logger.IKELog.Errorf("APER unmarshal with parameter failed: %+v", err)
return 0, nil, nil, errors.New("Unmarshal failed when decoding GUAMI")
Expand Down Expand Up @@ -116,7 +116,7 @@ func UnmarshalEAP5GData(codedData []byte) (eap5GMessageID uint8, anParameters *A
plmnField = append(plmnField, parameterValue...)
// Decode PLMN using aper
ngapPLMN := new(ngapType.PLMNIdentity)
err := aper.UnmarshalWithParams(plmnField, ngapPLMN, "valueExt")
err = aper.UnmarshalWithParams(plmnField, ngapPLMN, "valueExt")
if err != nil {
logger.IKELog.Errorf("APER unmarshal with parameter failed: %v", err)
return 0, nil, nil, errors.New("Unmarshal failed when decoding PLMN")
Expand Down Expand Up @@ -281,8 +281,7 @@ func UnmarshalEAP5GData(codedData []byte) (eap5GMessageID uint8, anParameters *A
logger.IKELog.Error("No NASPDU length specified")
return 0, nil, nil, errors.New("Error formatting")
}

return
return eap5GMessageID, anParameters, nasPDU, err
} else {
return 0, nil, nil, errors.New("No data to decode")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ike/handler/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func CalculateDiffieHellmanMaterials(secret *big.Int, peerPublicValue []byte,
}
default:
logger.IKELog.Errorf("Unsupported Diffie-Hellman group: %d", diffieHellmanGroupNumber)
return
return localPublicValue, sharedKey
}

localPublicValue = new(big.Int).Exp(generator, secret, factor).Bytes()
Expand Down
6 changes: 3 additions & 3 deletions pkg/service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package service
import (
"context"
"fmt"
"io/ioutil"
"io"
"net"
"os"
"os/signal"
Expand Down Expand Up @@ -43,15 +43,15 @@ func (a *N3iwfApp) SetLogEnable(enable bool) {
logger.MainLog.Infof("Log enable is set to [%v]", enable)
if enable && logger.Log.Out == os.Stderr {
return
} else if !enable && logger.Log.Out == ioutil.Discard {
} else if !enable && logger.Log.Out == io.Discard {
return
}

a.cfg.SetLogEnable(enable)
if enable {
logger.Log.SetOutput(os.Stderr)
} else {
logger.Log.SetOutput(ioutil.Discard)
logger.Log.SetOutput(io.Discard)
}
}

Expand Down

0 comments on commit 15ca270

Please sign in to comment.