Skip to content

Commit

Permalink
handle review comments and drop copy methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tigrato committed Mar 29, 2024
1 parent 1aa5fd9 commit 18cce10
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 56 deletions.
1 change: 0 additions & 1 deletion api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/gravitational/teleport/api
go 1.21

require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24
github.com/coreos/go-semver v0.3.1
github.com/go-piv/piv-go v1.11.0
github.com/gobwas/ws v1.3.2
Expand Down
2 changes: 0 additions & 2 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,6 @@ cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcP
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8=
git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc=
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU=
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk=
Expand Down
17 changes: 0 additions & 17 deletions api/types/accesslist/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,3 @@ func (a *AccessListMember) MatchSearch(values []string) bool {
fieldVals := append(utils.MapToStrings(a.GetAllLabels()), a.GetName())
return types.MatchSearch(fieldVals, values, nil)
}

// Copy returns a copy of this resource.
// Copy is tested with FuzzAccessListMemberCopy.
func (a AccessListMember) Copy() AccessListMember {
return AccessListMember{
ResourceHeader: a.ResourceHeader.Copy(),
Spec: AccessListMemberSpec{
AccessList: a.Spec.AccessList,
Name: a.Spec.Name,
Joined: a.Spec.Joined,
Expires: a.Spec.Expires,
Reason: a.Spec.Reason,
AddedBy: a.Spec.AddedBy,
IneligibleStatus: a.Spec.IneligibleStatus,
},
}
}
13 changes: 0 additions & 13 deletions api/types/accesslist/member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"testing"
"time"

fuzz "github.com/AdaLogics/go-fuzz-headers"
"github.com/google/uuid"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -67,15 +66,3 @@ func TestAccessListMemberDefaults(t *testing.T) {
require.Error(t, err)
})
}

func FuzzAccessListMemberCopy(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
fuzzConsumer := fuzz.NewConsumer(data)
d := AccessListMember{}
if err := fuzzConsumer.GenerateStruct(&d); err != nil {
return /* skip cases where data is shorter than expected */
}
dCopy := d.Copy()
require.Equal(t, d, dCopy)
})
}
23 changes: 0 additions & 23 deletions api/types/header/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package header

import (
"maps"
"slices"
"time"

Expand Down Expand Up @@ -168,16 +167,6 @@ func (h *ResourceHeader) IsEqual(i *ResourceHeader) bool {
return deriveTeleportEqualResourceHeader(h, i)
}

// Copy returns a copy of the resource header.
func (h ResourceHeader) Copy() ResourceHeader {
return ResourceHeader{
Kind: h.Kind,
SubKind: h.SubKind,
Version: h.Version,
Metadata: h.Metadata.Copy(),
}
}

// Metadata is resource metadata
type Metadata struct {
// Name is an object name
Expand Down Expand Up @@ -308,15 +297,3 @@ func (m *Metadata) GetAllLabels() map[string]string {
func (m *Metadata) IsEqual(i *Metadata) bool {
return deriveTeleportEqualMetadata(m, i)
}

// Copy returns a copy of the metadata.
func (m Metadata) Copy() Metadata {
return Metadata{
Name: m.Name,
Description: m.Description,
Labels: maps.Clone(m.Labels),
Expires: m.Expires,
ID: m.ID,
Revision: m.Revision,
}
}

0 comments on commit 18cce10

Please sign in to comment.