Skip to content

Commit 309cc87

Browse files
authored
Merge pull request #30 from ohkinozomu/staticcheck-action
Add staticcheck-action
2 parents fa0a6f8 + 8d6fdf7 commit 309cc87

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,12 @@ jobs:
2626
run: |
2727
GO111MODULE=off go get github.com/mattn/goveralls
2828
$(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github
29+
staticcheck:
30+
name: "Run staticcheck"
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v3
35+
- uses: dominikh/[email protected]
36+
with:
37+
version: "2022.1"

dsse/sign_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ func (n errsigner) Public() crypto.PublicKey {
114114

115115
type errverifier int
116116

117-
var errVerify = fmt.Errorf("Accepted signatures do not match threshold, Found: 0, Expected 1")
118-
var errThreshold = fmt.Errorf("Invalid threshold")
117+
var errVerify = fmt.Errorf("accepted signatures do not match threshold, Found: 0, Expected 1")
118+
var errThreshold = fmt.Errorf("invalid threshold")
119119

120120
func (n errverifier) Sign(data []byte) ([]byte, error) {
121121
return data, nil
@@ -417,6 +417,7 @@ func TestVerifyMultipleProviderThreshold(t *testing.T) {
417417
var ns nilsigner
418418
var null nullsigner
419419
signer, err := NewMultiEnvelopeSigner(2, ns, null)
420+
assert.Nil(t, err)
420421
env, err := signer.SignPayload(payloadType, []byte(payload))
421422
assert.Nil(t, err, "sign failed")
422423

dsse/verify.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ func (ev *EnvelopeVerifier) Verify(e *Envelope) ([]AcceptedKey, error) {
104104

105105
// Sanity if with some reflect magic this happens.
106106
if ev.threshold <= 0 || ev.threshold > len(ev.providers) {
107-
return nil, errors.New("Invalid threshold")
107+
return nil, errors.New("invalid threshold")
108108
}
109109

110110
if len(usedKeyids) < ev.threshold {
111-
return acceptedKeys, errors.New(fmt.Sprintf("Accepted signatures do not match threshold, Found: %d, Expected %d", len(acceptedKeys), ev.threshold))
111+
return acceptedKeys, fmt.Errorf("accepted signatures do not match threshold, Found: %d, Expected %d", len(acceptedKeys), ev.threshold)
112112
}
113113

114114
return acceptedKeys, nil
@@ -121,7 +121,7 @@ func NewEnvelopeVerifier(v ...Verifier) (*EnvelopeVerifier, error) {
121121
func NewMultiEnvelopeVerifier(threshold int, p ...Verifier) (*EnvelopeVerifier, error) {
122122

123123
if threshold <= 0 || threshold > len(p) {
124-
return nil, errors.New("Invalid threshold")
124+
return nil, errors.New("invalid threshold")
125125
}
126126

127127
ev := EnvelopeVerifier{

0 commit comments

Comments
 (0)