From 258a17c4b6965187feb43452c2f7333bf5774c7d Mon Sep 17 00:00:00 2001 From: xiaok29 <1526783667@qq.com> Date: Fri, 31 May 2024 16:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20build:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove third-party packages --- codes/go/chapter_stack_and_queue/queue_test.go | 14 +++----------- codes/go/go.mod | 8 -------- codes/go/go.sum | 10 ---------- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/codes/go/chapter_stack_and_queue/queue_test.go b/codes/go/chapter_stack_and_queue/queue_test.go index fc43548b5..c25f0f12d 100644 --- a/codes/go/chapter_stack_and_queue/queue_test.go +++ b/codes/go/chapter_stack_and_queue/queue_test.go @@ -10,7 +10,6 @@ import ( "testing" . "github.com/krahets/hello-algo/pkg" - "github.com/stretchr/testify/assert" ) func TestQueue(t *testing.T) { @@ -47,20 +46,13 @@ func TestQueue(t *testing.T) { } func TestArrayQueue(t *testing.T) { - t.Run("pop", func(t *testing.T) { - queue := newArrayQueue(2) - assert.Equal(t, nil, queue.pop()) - - queue.push(1) - queue.push(2) - assert.Equal(t, 1, queue.pop()) - assert.Equal(t, 2, queue.pop()) - assert.Equal(t, []int{}, queue.toSlice()) - }) // 初始化队列,使用队列的通用接口 capacity := 10 queue := newArrayQueue(capacity) + if queue.pop() != nil { + t.Errorf("want:%v,got:%v", nil, queue.pop()) + } // 元素入队 queue.push(1) diff --git a/codes/go/go.mod b/codes/go/go.mod index e8853194a..34f5dac20 100644 --- a/codes/go/go.mod +++ b/codes/go/go.mod @@ -1,11 +1,3 @@ module github.com/krahets/hello-algo go 1.19 - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - -require github.com/stretchr/testify v1.9.0 diff --git a/codes/go/go.sum b/codes/go/go.sum index 60ce688a0..e69de29bb 100644 --- a/codes/go/go.sum +++ b/codes/go/go.sum @@ -1,10 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=