format code with gofumpt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2022-09-29 17:21:51 +02:00
parent fed93645f1
commit 1da95ff6aa
93 changed files with 199 additions and 177 deletions

View File

@ -11,7 +11,7 @@ import (
)
func TestMatchReleasedSignaturesSortOrder(t *testing.T) {
var releasesRole = data.DelegationRole{BaseRole: data.BaseRole{Name: trust.ReleasesRole}}
releasesRole := data.DelegationRole{BaseRole: data.BaseRole{Name: trust.ReleasesRole}}
targets := []client.TargetSignedStruct{
{Target: client.Target{Name: "target10-foo"}, Role: releasesRole},
{Target: client.Target{Name: "target1-foo"}, Role: releasesRole},

View File

@ -23,7 +23,8 @@ func TestTrustTag(t *testing.T) {
}{
{
trustTagContext{
s: SignedTagInfo{Name: trustedTag,
s: SignedTagInfo{
Name: trustedTag,
Digest: digest,
Signers: nil,
},
@ -33,7 +34,8 @@ func TestTrustTag(t *testing.T) {
},
{
trustTagContext{
s: SignedTagInfo{Name: trustedTag,
s: SignedTagInfo{
Name: trustedTag,
Digest: digest,
Signers: nil,
},
@ -44,7 +46,8 @@ func TestTrustTag(t *testing.T) {
// Empty signers makes a row with empty string
{
trustTagContext{
s: SignedTagInfo{Name: trustedTag,
s: SignedTagInfo{
Name: trustedTag,
Digest: digest,
Signers: nil,
},
@ -54,7 +57,8 @@ func TestTrustTag(t *testing.T) {
},
{
trustTagContext{
s: SignedTagInfo{Name: trustedTag,
s: SignedTagInfo{
Name: trustedTag,
Digest: digest,
Signers: []string{"alice", "bob", "claire"},
},
@ -65,7 +69,8 @@ func TestTrustTag(t *testing.T) {
// alphabetic signing on Signers
{
trustTagContext{
s: SignedTagInfo{Name: trustedTag,
s: SignedTagInfo{
Name: trustedTag,
Digest: digest,
Signers: []string{"claire", "bob", "alice"},
},
@ -85,7 +90,6 @@ func TestTrustTag(t *testing.T) {
}
func TestTrustTagContextWrite(t *testing.T) {
cases := []struct {
context formatter.Context
expected string
@ -140,7 +144,6 @@ tag3 bbbbbbbb
// With no trust data, the TagWrite will print an empty table:
// it's up to the caller to decide whether or not to print this versus an error
func TestTrustTagContextEmptyWrite(t *testing.T) {
emptyCase := struct {
context formatter.Context
expected string

View File

@ -8,8 +8,10 @@ import (
"github.com/theupdateframework/notary/tuf/data"
)
const releasedRoleName = "Repo Admin"
const releasesRoleTUFName = "targets/releases"
const (
releasedRoleName = "Repo Admin"
releasesRoleTUFName = "targets/releases"
)
// isReleasedTarget checks if a role name is "released":
// either targets/releases or targets TUF roles

View File

@ -139,7 +139,6 @@ func TestTrustRevokeCommand(t *testing.T) {
assert.Check(t, is.Contains(cli.OutBuffer().String(), tc.expectedMessage))
})
}
}
func TestGetSignableRolesForTargetAndRemoveError(t *testing.T) {

View File

@ -225,7 +225,6 @@ func TestGetReleasedTargetHashAndSize(t *testing.T) {
oneReleasedTgt = append(oneReleasedTgt, client.TargetSignedStruct{Role: mockDelegationRoleWithName("targets/releases"), Target: releasedTgt})
hash, _, _ := getReleasedTargetHashAndSize(oneReleasedTgt, "unreleased")
assert.Check(t, is.DeepEqual(data.Hashes{notary.SHA256: []byte("released-hash")}, hash))
}
func TestCreateTarget(t *testing.T) {
@ -280,5 +279,4 @@ func TestSignCommandLocalFlag(t *testing.T) {
cmd.SetArgs([]string{"--local", "reg-name.io/image:red"})
cmd.SetOut(io.Discard)
assert.ErrorContains(t, cmd.Execute(), "error contacting notary server: dial tcp: lookup reg-name.io")
}

View File

@ -65,7 +65,6 @@ func TestTrustSignerRemoveErrors(t *testing.T) {
cmd.Execute()
assert.Check(t, is.Contains(cli.ErrBuffer().String(), tc.expectedError))
}
}
func TestRemoveSingleSigner(t *testing.T) {
@ -89,6 +88,7 @@ func TestRemoveMultipleSigners(t *testing.T) {
"no signer test for repository signed-repo"))
assert.Check(t, is.Contains(cli.OutBuffer().String(), "Removing signer \"test\" from signed-repo...\n"))
}
func TestRemoveLastSignerWarning(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{})
cli.SetNotaryClient(notaryfake.GetLoadedNotaryRepository)