Sfoglia il codice sorgente

Don't use fmt.Errorf if unneeded

Andrew Swistak 6 anni fa
parent
commit
d8db35e9f4
1 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 3 2
      pokemon-parsing/gen7/parse.go

+ 3 - 2
pokemon-parsing/gen7/parse.go

@@ -3,6 +3,7 @@ package gen7
 import (
 	"bytes"
 	"encoding/binary"
+	"errors"
 	"fmt"
 	"strings"
 	"time"
@@ -185,11 +186,11 @@ func validateRawPokemon(rawPokemon p.RawPokemon) error {
 
 	checksumValue := toUint16(rawPokemon[0x06:0x08])
 	if calculatedChecksum := calculateChecksum(rawPokemon); calculatedChecksum != checksumValue {
-		return fmt.Errorf("Invalid checksum for generation 7 pokemon")
+		return errors.New("Invalid checksum for generation 7 pokemon")
 	}
 
 	if toUint16(rawPokemon[0x04:0x06]) == 1 || rawPokemon[0x58] == 1 || rawPokemon[0x90] == 1 || rawPokemon[0xc8] == 1 {
-		return fmt.Errorf("Invalid bytes supplied for generation 7 pokemon")
+		return errors.New("Invalid bytes supplied for generation 7 pokemon")
 	}
 
 	return nil