diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-12-23 01:59:59 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-12-23 01:59:59 +0100 |
commit | da2ad6ba3756aa397546ebe23e8e5d07959cbb15 (patch) | |
tree | 2949eeca5f60371522858e165c13e622b8f01720 /updater/signify.go | |
parent | version: bump (diff) | |
download | wireguard-windows-da2ad6ba3756aa397546ebe23e8e5d07959cbb15.tar.xz wireguard-windows-da2ad6ba3756aa397546ebe23e8e5d07959cbb15.zip |
global: use strings.Cut where possible
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'updater/signify.go')
-rw-r--r-- | updater/signify.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/updater/signify.go b/updater/signify.go index eef9198a..c9775147 100644 --- a/updater/signify.go +++ b/updater/signify.go @@ -53,17 +53,17 @@ func readFileList(input []byte) (fileList, error) { if len(line) == 0 && index == len(fileLines)-1 { break } - components := strings.SplitN(line, " ", 2) - if len(components) != 2 { + first, second, ok := strings.Cut(line, " ") + if !ok { return nil, errors.New("File hash line has too few components") } - maybeHash, err := hex.DecodeString(components[0]) + maybeHash, err := hex.DecodeString(first) if err != nil || len(maybeHash) != blake2b.Size256 { return nil, errors.New("File hash is invalid base64 or incorrect number of bytes") } var hash [blake2b.Size256]byte copy(hash[:], maybeHash) - fileHashes[components[1]] = hash + fileHashes[second] = hash } if len(fileHashes) == 0 { return nil, errors.New("No file hashes found in signed input") |