From baad1d55e366f31d2d9d135b969cf3c93314abf9 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Mon, 22 Jan 2024 15:48:54 +0100 Subject: [PATCH] Fix gosec warnings --- integration_tests/helper_test.go | 2 +- model/commondatatypes_additions_test.go | 6 ++++-- spine/helper_test.go | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/integration_tests/helper_test.go b/integration_tests/helper_test.go index 71abca8..c73ff75 100644 --- a/integration_tests/helper_test.go +++ b/integration_tests/helper_test.go @@ -127,7 +127,7 @@ func initialCommunication(t *testing.T, remoteDevice api.DeviceRemote, writeHand } func loadFileData(t *testing.T, fileName string) []byte { - fileData, err := os.ReadFile(fileName) + fileData, err := os.ReadFile(fileName) // #nosec G304 if err != nil { t.Fatal(err) } diff --git a/model/commondatatypes_additions_test.go b/model/commondatatypes_additions_test.go index b29efbf..95c34ca 100644 --- a/model/commondatatypes_additions_test.go +++ b/model/commondatatypes_additions_test.go @@ -3,6 +3,8 @@ package model import ( "testing" "time" + + "github.com/enbility/spine-go/util" ) func TestTimeType(t *testing.T) { @@ -269,9 +271,9 @@ func TestFeatureAddressTypeString(t *testing.T) { for _, tc := range tc { f := FeatureAddressType{ - Device: &tc.device, + Device: util.Ptr(tc.device), Entity: tc.entity, - Feature: &tc.feature, + Feature: util.Ptr(tc.feature), } got := f.String() diff --git a/spine/helper_test.go b/spine/helper_test.go index 6f30b25..f9213c1 100644 --- a/spine/helper_test.go +++ b/spine/helper_test.go @@ -101,7 +101,7 @@ func (t *WriteMessageHandler) ResultWithReference(msgCounterReference *model.Msg } func loadFileData(t *testing.T, fileName string) []byte { - fileData, err := os.ReadFile(fileName) + fileData, err := os.ReadFile(fileName) // #nosec G304 if err != nil { t.Fatal(err) } @@ -110,7 +110,7 @@ func loadFileData(t *testing.T, fileName string) []byte { } func checkSentData(t *testing.T, sendBytes []byte, msgSendFilePrefix string) { - msgSendExpectedBytes, err := os.ReadFile(msgSendFilePrefix + "_expected.json") + msgSendExpectedBytes, err := os.ReadFile(msgSendFilePrefix + "_expected.json") // #nosec G304 if err != nil { t.Fatal(err) }