diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fcdd12a..a3cf82a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: uses: actions/checkout@v1 - name: Test - run: ./test + run: go test ./... -timeout 5m -race -coverprofile=coverage.txt -covermode=atomic - name: Sumbit code cov if: success() diff --git a/README.md b/README.md index 6a14eba..6f466e0 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ import ( "strconv" "sync/atomic" - "github.com/jolestar/go-commons-pool" + "github.com/jolestar/go-commons-pool/v2" ) func Example_simple() { @@ -99,7 +99,7 @@ import ( "strconv" "sync/atomic" - "github.com/jolestar/go-commons-pool" + "github.com/jolestar/go-commons-pool/v2" ) type MyPoolObject struct { diff --git a/collections/queue.go b/collections/queue.go index de578cb..666c9f5 100644 --- a/collections/queue.go +++ b/collections/queue.go @@ -5,7 +5,7 @@ import ( "errors" "sync" - "github.com/jolestar/go-commons-pool/concurrent" + "github.com/jolestar/go-commons-pool/v2/concurrent" ) // InterruptedErr when deque block method bean interrupted will return this err diff --git a/collections/queue_test.go b/collections/queue_test.go index b089586..bd46dbe 100644 --- a/collections/queue_test.go +++ b/collections/queue_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/jolestar/go-commons-pool/concurrent" + "github.com/jolestar/go-commons-pool/v2/concurrent" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) diff --git a/example__simple_test.go b/example__simple_test.go index c57c99a..6894fb7 100644 --- a/example__simple_test.go +++ b/example__simple_test.go @@ -6,7 +6,7 @@ import ( "strconv" "sync/atomic" - "github.com/jolestar/go-commons-pool" + "github.com/jolestar/go-commons-pool/v2" ) func Example_simple() { diff --git a/example_customFactory_test.go b/example_customFactory_test.go index 385f4f9..29319bb 100644 --- a/example_customFactory_test.go +++ b/example_customFactory_test.go @@ -6,7 +6,7 @@ import ( "strconv" "sync/atomic" - "github.com/jolestar/go-commons-pool" + "github.com/jolestar/go-commons-pool/v2" ) type MyPoolObject struct { diff --git a/example_multipleBorrowers_test.go b/example_multipleBorrowers_test.go index 3dff7a2..050f043 100644 --- a/example_multipleBorrowers_test.go +++ b/example_multipleBorrowers_test.go @@ -6,7 +6,7 @@ import ( "strconv" "sync/atomic" - "github.com/jolestar/go-commons-pool" + "github.com/jolestar/go-commons-pool/v2" ) func Example_multipleBorrowers() { diff --git a/go.mod b/go.mod index 2877974..c9c6dfe 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,10 @@ -module github.com/jolestar/go-commons-pool +module github.com/jolestar/go-commons-pool/v2 go 1.13 require ( + github.com/davecgh/go-spew v1.1.1 // indirect github.com/fortytw2/leaktest v1.3.0 github.com/stretchr/testify v1.4.0 + gopkg.in/yaml.v2 v2.2.5 // indirect ) diff --git a/go.sum b/go.sum index 5188a4f..8a00791 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,17 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/jolestar/go-commons-pool v2.0.0+incompatible h1:uHn5uRKsLLQSf9f1J5QPY2xREWx/YH+e4bIIXcAuAaE= -github.com/jolestar/go-commons-pool v2.0.0+incompatible/go.mod h1:ChJYIbIch0DMCSU6VU0t0xhPoWDR2mMFIQek3XWU0s8= 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/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +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.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/object.go b/object.go index 4004fd8..844d3cb 100644 --- a/object.go +++ b/object.go @@ -5,7 +5,7 @@ import ( "sync" "time" - "github.com/jolestar/go-commons-pool/collections" + "github.com/jolestar/go-commons-pool/v2/collections" ) // PooledObjectState is PooledObjectState enum const diff --git a/pool.go b/pool.go index 7ece036..bbce332 100644 --- a/pool.go +++ b/pool.go @@ -7,8 +7,8 @@ import ( "sync" "time" - "github.com/jolestar/go-commons-pool/collections" - "github.com/jolestar/go-commons-pool/concurrent" + "github.com/jolestar/go-commons-pool/v2/collections" + "github.com/jolestar/go-commons-pool/v2/concurrent" ) type baseErr struct { @@ -594,7 +594,7 @@ func (pool *ObjectPool) evict(ctx context.Context) { var idleSoftEvictTime = time.Duration(math.MaxInt64) if pool.Config.SoftMinEvictableIdleTime > 0 { - idleSoftEvictTime = pool.Config.SoftMinEvictableIdleTime; + idleSoftEvictTime = pool.Config.SoftMinEvictableIdleTime } evictionConfig := EvictionConfig{ IdleEvictTime: idleEvictTime, diff --git a/pool_abandoned_test.go b/pool_abandoned_test.go index 160d568..70c30ef 100644 --- a/pool_abandoned_test.go +++ b/pool_abandoned_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/jolestar/go-commons-pool/concurrent" + "github.com/jolestar/go-commons-pool/v2/concurrent" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) diff --git a/pool_perf_test.go b/pool_perf_test.go index 1725840..688eb10 100644 --- a/pool_perf_test.go +++ b/pool_perf_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/jolestar/go-commons-pool/concurrent" + "github.com/jolestar/go-commons-pool/v2/concurrent" ) type BenchObject struct { diff --git a/pool_test.go b/pool_test.go index 42adfc1..cc53e65 100644 --- a/pool_test.go +++ b/pool_test.go @@ -14,8 +14,8 @@ import ( "time" "github.com/fortytw2/leaktest" - "github.com/jolestar/go-commons-pool/collections" - "github.com/jolestar/go-commons-pool/concurrent" + "github.com/jolestar/go-commons-pool/v2/collections" + "github.com/jolestar/go-commons-pool/v2/concurrent" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) diff --git a/test b/test deleted file mode 100755 index 86be157..0000000 --- a/test +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -e -echo "" > coverage.txt - -for d in $(go list ./...); do - go test -timeout 5m -race -coverprofile=profile.out -covermode=atomic $d - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done \ No newline at end of file