Skip to content

Commit

Permalink
Fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndereAndi committed Aug 28, 2024
1 parent 35c86c3 commit b57fe56
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion ship/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,5 +290,4 @@ func (s *ConnectionSuite) Test_HandshakeTimer() {
assert.Equal(s.T(), model.CmiStateServerWait, s.sut.getState())
assert.Equal(s.T(), timeoutTimerTypeWaitForReady, s.sut.getHandshakeTimerType())
assert.Equal(s.T(), true, s.sut.getHandshakeTimerRunning())

}
5 changes: 2 additions & 3 deletions ship/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func TestJsonFromEEBUSJson(t *testing.T) {

// The PMCP device mistakenly adds an `0x00` byte at the end of many messages. Test if this is handled correctly
func TestJsonFromEEBUSJsonTrailingZeros(t *testing.T) {

bytes := []byte(`{"datagram":[{"header":[{"specificationVersion":"1.2.0"},{"addressSource":[{"device":"d:_i:3210_EVSE"},{"entity":[1,1]},{"feature":6}]},{"addressDestination":[{"device":"d:_i:3210_HEMS"},{"entity":[1]},{"feature":1}]},{"msgCounter":194},{"msgCounterReference":4890},{"cmdClassifier":"reply"}]},{"payload":[{"cmd":[[{"deviceClassificationManufacturerData":[{"deviceName":""},{"deviceCode":""},{"brandName":""},{"powerSource":"mains3Phase"}]}]]}]}]}`)
bytes = append(bytes, 0x00)

Expand Down Expand Up @@ -57,7 +56,7 @@ func TestShipJsonIntoEEBUSJson(t *testing.T) {
// TODO: move this test into connection_test using "transformSpineDataIntoShipJson()"
spineMsg, err := JsonIntoEEBUSJson([]byte(spineTest))
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
payload := json.RawMessage([]byte(spineMsg))

Expand All @@ -72,7 +71,7 @@ func TestShipJsonIntoEEBUSJson(t *testing.T) {

msg, err := json.Marshal(shipMessage)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}

json, err := JsonIntoEEBUSJson(msg)
Expand Down
1 change: 0 additions & 1 deletion ship/hs_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func (c *ShipConnection) handshakeAccessMethods_Request(message []byte) {

c.infoProvider.ReportServiceShipID(c.remoteSKI, c.remoteShipID)
}

} else {
c.endHandshakeWithError(fmt.Errorf("access methods: invalid response: %s", dataString))
return
Expand Down
4 changes: 2 additions & 2 deletions ship/hs_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ func (c *ShipConnection) handshakeInit_cmiStateEvaluate(message []byte) bool {
msgType, data := c.parseMessage(message, false)

if msgType != model.MsgTypeInit {
c.endHandshakeWithError(fmt.Errorf("Invalid SHIP MessageType, expected 0 and got %s" + string(msgType)))
c.endHandshakeWithError(fmt.Errorf("Invalid SHIP MessageType, expected 0 and got %s", string(msgType)))
return false
}
if len(data) > 0 && data[0] != byte(0) {
c.endHandshakeWithError(fmt.Errorf("Invalid SHIP MessageValue, expected 0 and got %s" + string(data)))
c.endHandshakeWithError(fmt.Errorf("Invalid SHIP MessageValue, expected 0 and got %s", string(data)))
return false
}

Expand Down
2 changes: 1 addition & 1 deletion ship/hs_prot.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (c *ShipConnection) handshakeProtocol_smeProtHStateClientListenChoice(messa
abort = true
}

if msgHandshake.Formats.Format == nil || len(msgHandshake.Formats.Format) == 0 {
if len(msgHandshake.Formats.Format) == 0 {
logging.Log().Debug("format is missing")
abort = true
}
Expand Down

0 comments on commit b57fe56

Please sign in to comment.