Skip to content

Commit

Permalink
deps: remove copier dependency (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
v-byte-cpu committed Jun 11, 2021
1 parent c83dae3 commit be04062
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/golang/mock v1.5.0
github.com/google/gopacket v1.1.20-0.20210304165259-20562ffb40f8
github.com/gorilla/mux v1.8.0 // indirect
github.com/jinzhu/copier v0.2.9
github.com/mailru/easyjson v0.7.7
github.com/moby/moby v20.10.6+incompatible
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jinzhu/copier v0.2.9 h1:v0Wnz+GKEI63FX7cU2LI20mFFlhTNl+36cjDIuhq3QY=
github.com/jinzhu/copier v0.2.9/go.mod h1:24xnZezI2Yqac9J61UC6/dG/k76ttpq0DdJI3QmUvro=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
Expand Down
10 changes: 3 additions & 7 deletions pkg/scan/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"github.com/golang/mock/gomock"
"github.com/google/gopacket"
"github.com/jinzhu/copier"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/v-byte-cpu/sx/pkg/packet"
Expand Down Expand Up @@ -134,7 +133,7 @@ func TestPacketSourceReturnsError(t *testing.T) {
reqgen := NewMockRequestGenerator(ctrl)
pktgen := NewMockPacketGenerator(ctrl)

expectedScanRange := &Range{
scanRange := &Range{
SrcIP: net.IPv4(192, 168, 0, 1),
SrcMAC: net.HardwareAddr{0x1, 0x2, 0x3, 0x4, 0x5, 0x6},
Ports: []*PortRange{
Expand All @@ -144,15 +143,12 @@ func TestPacketSourceReturnsError(t *testing.T) {
},
},
}
var scanRange Range
err := copier.Copy(&scanRange, expectedScanRange)
require.NoError(t, err)

reqgen.EXPECT().GenerateRequests(gomock.Not(gomock.Nil()), expectedScanRange).
reqgen.EXPECT().GenerateRequests(gomock.Not(gomock.Nil()), scanRange).
Return(nil, errors.New("generate error"))

ps := NewPacketSource(reqgen, pktgen)
out := ps.Packets(context.Background(), &scanRange)
out := ps.Packets(context.Background(), scanRange)
result := <-out
require.Error(t, result.Err)
}()
Expand Down

0 comments on commit be04062

Please sign in to comment.