remove whitespace from hashBuf (#3622)
Some checks failed
code_lint / golangci_lint (push) Has been cancelled
code_lint / mod_tidy (push) Has been cancelled
code_lint / api_docs (push) Has been cancelled
code_test / test_64 (push) Has been cancelled
code_test / test_32 (push) Has been cancelled
code_test / test_highlevel (push) Has been cancelled

* remove whitespace from hashBuf

* merge bytes.TrimSpace and strings.TrimSpace

---------

Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
Yang-Sang-Ho 2024-08-10 18:15:17 +09:00 committed by GitHub
parent 6225706c82
commit c8f1fa93f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,9 +44,11 @@ func do() error {
if err != nil {
return err
}
hash := make([]byte, hex.DecodedLen(len(hashBuf)))
if _, err = hex.Decode(hash, bytes.TrimSpace(hashBuf)); err != nil {
str := strings.TrimSpace(string(hashBuf))
hash, err := hex.DecodeString(str)
if err != nil {
return err
}