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

Add GHA for staticcheck #215

Merged
merged 1 commit into from
Aug 16, 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
14 changes: 14 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ jobs:
- name: Build Docker image
run: make docker-build

staticcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: WillAbides/[email protected]
with:
go-version-file: 'go.mod'

- uses: dominikh/[email protected]
with:
version: latest
install-go: false

lint:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ linters:
- gofmt
- govet
- errcheck
- staticcheck
- unused
- gosimple
- ineffassign
Expand Down
14 changes: 7 additions & 7 deletions factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,55 +121,55 @@ func (c *Config) Validate() (err error) {
PIter.ProcMap[1] = common.GetProcId(x[0])
PIter.WaitMap[1], err = strconv.Atoi(x[1])
if err != nil {
return fmt.Errorf("Value is not converted to integer: %v\n", err)
return fmt.Errorf("value is not converted to integer: %v", err)
}
}
if len(v1.Second) > 0 {
x := strings.Fields(v1.Second)
PIter.ProcMap[2] = common.GetProcId(x[0])
PIter.WaitMap[2], err = strconv.Atoi(x[1])
if err != nil {
return fmt.Errorf("Value is not converted to integer: %v\n", err)
return fmt.Errorf("value is not converted to integer: %v", err)
}
}
if len(v1.Third) > 0 {
x := strings.Fields(v1.Third)
PIter.ProcMap[3] = common.GetProcId(x[0])
PIter.WaitMap[3], err = strconv.Atoi(x[1])
if err != nil {
return fmt.Errorf("Value is not converted to integer: %v\n", err)
return fmt.Errorf("value is not converted to integer: %v", err)
}
}
if len(v1.Fourth) > 0 {
x := strings.Fields(v1.Fourth)
PIter.ProcMap[4] = common.GetProcId(x[0])
PIter.WaitMap[4], err = strconv.Atoi(x[1])
if err != nil {
return fmt.Errorf("Value is not converted to integer: %v\n", err)
return fmt.Errorf("value is not converted to integer: %v", err)
}
}
if len(v1.Fifth) > 0 {
x := strings.Fields(v1.Fifth)
PIter.ProcMap[5] = common.GetProcId(x[0])
PIter.WaitMap[5], err = strconv.Atoi(x[1])
if err != nil {
return fmt.Errorf("Value is not converted to integer: %v\n", err)
return fmt.Errorf("value is not converted to integer: %v", err)
}
}
if len(v1.Sixth) > 0 {
x := strings.Fields(v1.Sixth)
PIter.ProcMap[6] = common.GetProcId(x[0])
PIter.WaitMap[6], err = strconv.Atoi(x[1])
if err != nil {
return fmt.Errorf("Value is not converted to integer: %v\n", err)
return fmt.Errorf("value is not converted to integer: %v", err)
}
}
if len(v1.Seventh) > 0 {
x := strings.Fields(v1.Seventh)
PIter.ProcMap[7] = common.GetProcId(x[0])
PIter.WaitMap[7], err = strconv.Atoi(x[1])
if err != nil {
return fmt.Errorf("Value is not converted to integer: %v\n", err)
return fmt.Errorf("value is not converted to integer: %v", err)
}
}
v.PIterations[v1.Name] = PIter // add iterations in the custom profile
Expand Down
2 changes: 1 addition & 1 deletion factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func CheckConfigVersion() error {
currentVersion := AppConfig.GetVersion()

if currentVersion != GNBSIM_EXPECTED_CONFIG_VERSION {
return fmt.Errorf("config version is [%s], but expected is [%s].",
return fmt.Errorf("config version is [%s], but expected is [%s]",
currentVersion, GNBSIM_EXPECTED_CONFIG_VERSION)
}

Expand Down
2 changes: 1 addition & 1 deletion gnodeb/worker/gnbamfworker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func HandleMessage(gnb *gnbctx.GNodeB, amf *gnbctx.GnbAmf, pkt []byte, id uint64
case ngapType.NGAPPDUPresentInitiatingMessage:
initiatingMessage := pdu.InitiatingMessage
if initiatingMessage == nil {
return fmt.Errorf("Initiatiting Message is nil")
return fmt.Errorf("initiatiting Message is nil")
}
switch initiatingMessage.ProcedureCode.Value {
case ngapType.ProcedureCodeDownlinkNASTransport:
Expand Down
2 changes: 1 addition & 1 deletion profile/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func InitProfile(profile *profctx.Profile, summaryChan chan common.InterfaceMess

gnb, err := factory.AppConfig.Configuration.GetGNodeB(profile.GnbName)
if err != nil {
err = fmt.Errorf("Failed to fetch gNB context: %v", err)
err = fmt.Errorf("failed to fetch gNB context: %v", err)
summary.ErrorList = append(summary.ErrorList, err)
summaryChan <- summary
return
Expand Down
4 changes: 2 additions & 2 deletions util/test/ngsetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const NgapPPID uint32 = 0x3c000000
func getNgapIp(amfIP, ranIP string, amfPort, ranPort int) (amfAddr, ranAddr *sctp.SCTPAddr, err error) {
ips := []net.IPAddr{}
if ip, err1 := net.ResolveIPAddr("ip", amfIP); err1 != nil {
err = fmt.Errorf("Error resolving address '%s': %v", amfIP, err1)
err = fmt.Errorf("error resolving address '%s': %v", amfIP, err1)
return nil, nil, err
} else {
ips = append(ips, *ip)
Expand All @@ -28,7 +28,7 @@ func getNgapIp(amfIP, ranIP string, amfPort, ranPort int) (amfAddr, ranAddr *sct
}
ips = []net.IPAddr{}
if ip, err1 := net.ResolveIPAddr("ip", ranIP); err1 != nil {
err = fmt.Errorf("Error resolving address '%s': %v", ranIP, err1)
err = fmt.Errorf("error resolving address '%s': %v", ranIP, err1)
return nil, nil, err
} else {
ips = append(ips, *ip)
Expand Down
2 changes: 1 addition & 1 deletion util/test/rawudp.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func BuildRawUdpIp(srcIP, dstIP string, srcPort, dstPort uint16, payload []byte)
udplen := 8 + len(payload)
totalLen := 20 + udplen
if totalLen > 0xffff {
err = fmt.Errorf("message is too large to fit into a packet: %v > %v\n", totalLen, 0xffff)
err = fmt.Errorf("message is too large to fit into a packet: %v > %v", totalLen, 0xffff)
return nil, err
}

Expand Down