Skip to content

Commit 5b92546

Browse files
lint fmt
Signed-off-by: Hayden <[email protected]>
1 parent 6a01c50 commit 5b92546

File tree

7 files changed

+42
-42
lines changed

7 files changed

+42
-42
lines changed

cmd/cosign/cli/verify/verify_blob_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737

3838
"github.com/cyberphone/json-canonicalization/go/src/webpki.org/jsoncanonicalizer"
3939
"github.com/go-openapi/runtime"
40-
"github.com/go-openapi/swag"
40+
"github.com/go-openapi/swag/conv"
4141
"github.com/sigstore/cosign/v2/cmd/cosign/cli/options"
4242
"github.com/sigstore/cosign/v2/internal/pkg/cosign/tsa/mock"
4343
"github.com/sigstore/cosign/v2/internal/test"
@@ -701,9 +701,9 @@ func makeRekorEntry(t *testing.T, rekorSigner signature.ECDSASignerVerifier,
701701
}
702702
e := models.LogEntryAnon{
703703
Body: base64.StdEncoding.EncodeToString(leaf),
704-
IntegratedTime: swag.Int64(integratedTime.Unix()),
705-
LogIndex: swag.Int64(0),
706-
LogID: swag.String(logID),
704+
IntegratedTime: conv.Pointer(integratedTime.Unix()),
705+
LogIndex: conv.Pointer(int64(0)),
706+
LogID: conv.Pointer(logID),
707707
}
708708
// Marshal payload, sign, and set SET in Bundle
709709
jsonPayload, err := json.Marshal(e)
@@ -723,9 +723,9 @@ func makeRekorEntry(t *testing.T, rekorSigner signature.ECDSASignerVerifier,
723723
e.Verification = &models.LogEntryAnonVerification{
724724
SignedEntryTimestamp: bundleSig,
725725
InclusionProof: &models.InclusionProof{
726-
LogIndex: swag.Int64(0),
727-
TreeSize: swag.Int64(1),
728-
RootHash: swag.String(hex.EncodeToString(uuid)),
726+
LogIndex: conv.Pointer(int64(0)),
727+
TreeSize: conv.Pointer(int64(1)),
728+
RootHash: conv.Pointer(hex.EncodeToString(uuid)),
729729
Hashes: []string{},
730730
},
731731
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ require (
1616
github.com/go-openapi/runtime v0.28.0
1717
github.com/go-openapi/strfmt v0.23.0
1818
github.com/go-openapi/swag v0.24.1
19+
github.com/go-openapi/swag/conv v0.24.0
1920
github.com/go-piv/piv-go/v2 v2.4.0
2021
github.com/google/certificate-transparency-go v1.3.2
2122
github.com/google/go-cmp v0.7.0
@@ -174,7 +175,6 @@ require (
174175
github.com/go-openapi/loads v0.22.0 // indirect
175176
github.com/go-openapi/spec v0.21.0 // indirect
176177
github.com/go-openapi/swag/cmdutils v0.24.0 // indirect
177-
github.com/go-openapi/swag/conv v0.24.0 // indirect
178178
github.com/go-openapi/swag/fileutils v0.24.0 // indirect
179179
github.com/go-openapi/swag/jsonname v0.24.0 // indirect
180180
github.com/go-openapi/swag/jsonutils v0.24.0 // indirect

internal/pkg/cosign/rekor/signer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"strings"
2222
"testing"
2323

24-
"github.com/go-openapi/swag"
24+
"github.com/go-openapi/swag/conv"
2525
"github.com/sigstore/cosign/v2/internal/pkg/cosign/payload"
2626
"github.com/sigstore/cosign/v2/internal/pkg/cosign/rekor/mock"
2727
"github.com/sigstore/cosign/v2/pkg/cosign"
@@ -52,7 +52,7 @@ func TestSigner(t *testing.T) {
5252

5353
mClient.Entries = &mock.EntriesClient{
5454
Entries: []*models.LogEntry{{"123": models.LogEntryAnon{
55-
LogIndex: swag.Int64(123),
55+
LogIndex: conv.Pointer(int64(123)),
5656
}}},
5757
}
5858

pkg/cosign/bundle/protobundle_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"testing"
1919

2020
"github.com/go-openapi/strfmt"
21-
"github.com/go-openapi/swag"
21+
"github.com/go-openapi/swag/conv"
2222
"github.com/sigstore/rekor/pkg/generated/models"
2323
_ "github.com/sigstore/rekor/pkg/types/hashedrekord"
2424
_ "github.com/sigstore/rek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wYzBkQlVWRkNaemM0ZDBGUldVVkZXRXBzV201TmRtRkhWbWhhU0UxMllsZEdlbVJIVm5sTlEwRkhRMmx6UndwQlVWRkNaemM0ZDBGUlVVVkZhMG94WVZkNGEwbEdVbXhqTTFGblZVaFdhV0pIYkhwaFJFRkxRbWRuY1docmFrOVFVVkZFUVhkT2IwRkVRbXhCYWtWQkNtdDJORTFLYUdGRGFFMUJaMHBWVTNWWll6bFBWRWt3WTB0bU9XTnlObU14Y1RreVYyOXFMM1ZsV0RKRFR6Z3JMMDQyU25SM1FVNTRVSElyTjNWNlpGQUtRV3BDYVhwR2NHZEVMelJzWW5aa1NuRnplWE5HYlVSeU1TdFNNSGhKWjI1S1N5c3JaWGROYmtKaVMxQkVMemd3VTNJelFYTTVMMWxxV1U5M05EVjRkUXA2ZVdzOUNpMHRMUzB0UlU1RUlFTkZVbFJKUmtsRFFWUkZMUzB0TFMwSyJ9fX19",
55-
IntegratedTime: swag.Int64(123),
56-
LogID: swag.String("deadbeef"),
57-
LogIndex: swag.Int64(2),
55+
IntegratedTime: conv.Pointer(int64(123)),
56+
LogID: conv.Pointer("deadbeef"),
57+
LogIndex: conv.Pointer(int64(2)),
5858
Verification: &models.LogEntryAnonVerification{
5959
InclusionProof: &models.InclusionProof{
60-
Checkpoint: swag.String("checkpoint"),
60+
Checkpoint: conv.Pointer("checkpoint"),
6161
Hashes: []string{"deadbeef", "abcdefaa"},
62-
LogIndex: swag.Int64(1),
63-
RootHash: swag.String("abcdefaa"),
64-
TreeSize: swag.Int64(2),
62+
LogIndex: conv.Pointer(int64(1)),
63+
RootHash: conv.Pointer("abcdefaa"),
64+
TreeSize: conv.Pointer(int64(2)),
6565
},
6666
SignedEntryTimestamp: strfmt.Base64("set"),
6767
},

pkg/cosign/bundle/rekor_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"time"
2222

2323
"github.com/go-openapi/strfmt"
24-
"github.com/go-openapi/swag"
24+
"github.com/go-openapi/swag/conv"
2525
"github.com/sigstore/rekor/pkg/generated/models"
2626
)
2727

@@ -34,24 +34,24 @@ func TestRekorBundle(t *testing.T) {
3434
name: "tlog entry without verification - nil bundle",
3535
logEntry: &models.LogEntryAnon{
3636
Body: base64.StdEncoding.EncodeToString([]byte("TEST")),
37-
IntegratedTime: swag.Int64(time.Now().Unix()),
38-
LogIndex: swag.Int64(0),
39-
LogID: swag.String("c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d"),
37+
IntegratedTime: conv.Pointer(time.Now().Unix()),
38+
LogIndex: conv.Pointer(int64(0)),
39+
LogID: conv.Pointer("c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d"),
4040
},
4141
expectedRekorBundle: nil,
4242
}, {
4343
name: "tlog entry with verification",
4444
logEntry: &models.LogEntryAnon{
4545
Body: base64.StdEncoding.EncodeToString([]byte("TEST")),
46-
IntegratedTime: swag.Int64(time.Now().Unix()),
47-
LogIndex: swag.Int64(0),
48-
LogID: swag.String("c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d"),
46+
IntegratedTime: conv.Pointer(time.Now().Unix()),
47+
LogIndex: conv.Pointer(int64(0)),
48+
LogID: conv.Pointer("c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d"),
4949
Verification: &models.LogEntryAnonVerification{
5050
SignedEntryTimestamp: strfmt.Base64([]byte("signature")),
5151
InclusionProof: &models.InclusionProof{
52-
LogIndex: swag.Int64(0),
53-
TreeSize: swag.Int64(1),
54-
RootHash: swag.String("TEST"),
52+
LogIndex: conv.Pointer(int64(0)),
53+
TreeSize: conv.Pointer(int64(1)),
54+
RootHash: conv.Pointer("TEST"),
5555
Hashes: []string{},
5656
},
5757
},

pkg/cosign/tlog_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"testing"
3030
"time"
3131

32-
"github.com/go-openapi/swag"
32+
"github.com/go-openapi/swag/conv"
3333
ttestdata "github.com/google/certificate-transparency-go/trillian/testdata"
3434
"github.com/sigstore/rekor/pkg/generated/models"
3535
rtypes "github.com/sigstore/rekor/pkg/types"
@@ -214,19 +214,19 @@ func TestVerifyTLogEntryOfflineFailsWithInvalidPublicKey(t *testing.T) {
214214
}
215215
lea := &models.LogEntryAnon{
216216
Body: base64.StdEncoding.EncodeToString(canonicalEntry),
217-
LogIndex: swag.Int64(0),
218-
LogID: swag.String(logID),
219-
IntegratedTime: swag.Int64(time.Now().Unix()),
217+
LogIndex: conv.Pointer(int64(0)),
218+
LogID: conv.Pointer(logID),
219+
IntegratedTime: conv.Pointer(time.Now().Unix()),
220220
}
221221
entryUUID, err := ComputeLeafHash(lea)
222222
if err != nil {
223223
t.Fatal(err)
224224
}
225225
lea.Verification = &models.LogEntryAnonVerification{
226226
InclusionProof: &models.InclusionProof{
227-
LogIndex: swag.Int64(0),
228-
TreeSize: swag.Int64(1),
229-
RootHash: swag.String(hex.EncodeToString(entryUUID)),
227+
LogIndex: conv.Pointer(int64(0)),
228+
TreeSize: conv.Pointer(int64(1)),
229+
RootHash: conv.Pointer(hex.EncodeToString(entryUUID)),
230230
Hashes: []string{},
231231
},
232232
}

pkg/cosign/verify_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040

4141
"github.com/cyberphone/json-canonicalization/go/src/webpki.org/jsoncanonicalizer"
4242
"github.com/go-openapi/strfmt"
43-
"github.com/go-openapi/swag"
43+
"github.com/go-openapi/swag/conv"
4444
v1 "github.com/google/go-containerregistry/pkg/v1"
4545
"github.com/in-toto/in-toto-golang/in_toto"
4646
"github.com/secure-systems-lab/go-securesystemslib/dsse"
@@ -1689,9 +1689,9 @@ func createRekorEntry(ctx context.Context, t *testing.T, logID string, signer si
16891689
integratedTime := time.Now().Unix()
16901690
logEntry := models.LogEntryAnon{
16911691
Body: base64.StdEncoding.EncodeToString(canonicalEntry),
1692-
IntegratedTime: swag.Int64(integratedTime),
1693-
LogIndex: swag.Int64(0),
1694-
LogID: swag.String(logID),
1692+
IntegratedTime: conv.Pointer(integratedTime),
1693+
LogIndex: conv.Pointer(int64(0)),
1694+
LogID: conv.Pointer(logID),
16951695
}
16961696

16971697
// Canonicalize the log entry and sign it
@@ -1711,9 +1711,9 @@ func createRekorEntry(ctx context.Context, t *testing.T, logID string, signer si
17111711
logEntry.Verification = &models.LogEntryAnonVerification{
17121712
SignedEntryTimestamp: signedEntryTimestamp,
17131713
InclusionProof: &models.InclusionProof{
1714-
LogIndex: swag.Int64(0),
1715-
TreeSize: swag.Int64(1),
1716-
RootHash: swag.String(hex.EncodeToString(entryUUID)),
1714+
LogIndex: conv.Pointer(int64(0)),
1715+
TreeSize: conv.Pointer(int64(1)),
1716+
RootHash: conv.Pointer(hex.EncodeToString(entryUUID)),
17171717
Hashes: []string{},
17181718
},
17191719
}

0 commit comments

Comments
 (0)