mirror of
https://github.com/tendermint/tendermint.git
synced 2025-12-23 06:15:19 +00:00
* ci: Fix linter complaint (#9645)
Fixes a very silly linter complaint that makes absolutely no sense and is blocking the merging of several PRs.
---
#### PR checklist
- [x] Tests written/updated, or no tests needed
- [x] `CHANGELOG_PENDING.md` updated, or no changelog entry needed
- [x] Updated relevant documentation (`docs/`) and code comments, or no
documentation updates needed
(cherry picked from commit 83b7f4ad5b)
# Conflicts:
# .github/workflows/lint.yml
# .golangci.yml
# cmd/tendermint/commands/debug/util.go
* Resolve conflicts
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* ci: Sync golangci-lint config with main
Minus the spelling configuration that restricts spelling to US English
only.
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* make format
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Remove usage of deprecated io/ioutil package
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Remove unused mockBlockStore
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* blockchain/v2: Remove unused method
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Bulk fix lints
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* lint: Ignore auto-generated query PEG
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Co-authored-by: Thane Thomson <connect@thanethomson.com>
40 lines
931 B
Go
40 lines
931 B
Go
package armor
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"io"
|
|
|
|
"golang.org/x/crypto/openpgp/armor" //nolint: staticcheck
|
|
)
|
|
|
|
func EncodeArmor(blockType string, headers map[string]string, data []byte) string {
|
|
buf := new(bytes.Buffer)
|
|
w, err := armor.Encode(buf, blockType, headers)
|
|
if err != nil {
|
|
panic(fmt.Errorf("could not encode ascii armor: %s", err))
|
|
}
|
|
_, err = w.Write(data)
|
|
if err != nil {
|
|
panic(fmt.Errorf("could not encode ascii armor: %s", err))
|
|
}
|
|
err = w.Close()
|
|
if err != nil {
|
|
panic(fmt.Errorf("could not encode ascii armor: %s", err))
|
|
}
|
|
return buf.String()
|
|
}
|
|
|
|
func DecodeArmor(armorStr string) (blockType string, headers map[string]string, data []byte, err error) {
|
|
buf := bytes.NewBufferString(armorStr)
|
|
block, err := armor.Decode(buf)
|
|
if err != nil {
|
|
return "", nil, nil, err
|
|
}
|
|
data, err = io.ReadAll(block.Body)
|
|
if err != nil {
|
|
return "", nil, nil, err
|
|
}
|
|
return block.Type, block.Header, data, nil
|
|
}
|