Merge pull request #87 from tongjingran/golint
Fix golint and ineffassign
This commit is contained in:
commit
12095b8adb
4
go.mod
4
go.mod
@ -16,9 +16,9 @@ require (
|
|||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/spf13/viper v1.6.2
|
github.com/spf13/viper v1.6.2
|
||||||
github.com/stretchr/testify v1.5.1
|
github.com/stretchr/testify v1.5.1
|
||||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a
|
golang.org/x/net v0.0.0-20200625001655-4c5254603344
|
||||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
|
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
|
||||||
golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65
|
golang.org/x/tools v0.0.0-20200730221956-1ac65761fe2c
|
||||||
k8s.io/kubernetes v1.13.0
|
k8s.io/kubernetes v1.13.0
|
||||||
k8s.io/test-infra v0.0.0-20200511080351-8ac9dbfab055
|
k8s.io/test-infra v0.0.0-20200511080351-8ac9dbfab055
|
||||||
)
|
)
|
||||||
|
11
go.sum
11
go.sum
@ -739,6 +739,7 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q
|
|||||||
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8=
|
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8=
|
||||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
|
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
|
||||||
github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA=
|
github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA=
|
||||||
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
|
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
|
||||||
@ -792,6 +793,7 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh
|
|||||||
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM=
|
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM=
|
||||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@ -811,6 +813,7 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl
|
|||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||||
|
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
|
||||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||||
@ -819,6 +822,7 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG
|
|||||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
@ -850,6 +854,8 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL
|
|||||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0=
|
golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0=
|
||||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4=
|
||||||
|
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
@ -862,6 +868,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
|
|||||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@ -901,6 +908,8 @@ golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So=
|
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So=
|
||||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
|
||||||
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
@ -953,6 +962,8 @@ golang.org/x/tools v0.0.0-20200303214625-2b0b585e22fe h1:Kh3iY7o/2bMfQXZdwLdL9jD
|
|||||||
golang.org/x/tools v0.0.0-20200303214625-2b0b585e22fe/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
golang.org/x/tools v0.0.0-20200303214625-2b0b585e22fe/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||||
golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65 h1:1KSbntBked74wYsKq0jzXYy7ZwcjAUtrl7EmPE97Iiw=
|
golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65 h1:1KSbntBked74wYsKq0jzXYy7ZwcjAUtrl7EmPE97Iiw=
|
||||||
golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
||||||
|
golang.org/x/tools v0.0.0-20200730221956-1ac65761fe2c h1:c5JjBOQWM2pRemVbog00sS+oAdi8tTR+NNRFDwUOrTQ=
|
||||||
|
golang.org/x/tools v0.0.0-20200730221956-1ac65761fe2c/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
|
@ -145,7 +145,7 @@ func (b *Build) traversePkgsList() (isMod bool, root string, err error) {
|
|||||||
// and store it in the Build.tmpWorkdingDir
|
// and store it in the Build.tmpWorkdingDir
|
||||||
func (b *Build) getTmpwd() (string, error) {
|
func (b *Build) getTmpwd() (string, error) {
|
||||||
for _, pkg := range b.Pkgs {
|
for _, pkg := range b.Pkgs {
|
||||||
index := -1
|
var index int
|
||||||
var parentPath string
|
var parentPath string
|
||||||
if b.IsMod == false {
|
if b.IsMod == false {
|
||||||
index = strings.Index(b.WorkingDir, pkg.Root)
|
index = strings.Index(b.WorkingDir, pkg.Root)
|
||||||
|
@ -144,6 +144,7 @@ func TestFindWhereToInstall(t *testing.T) {
|
|||||||
OriGOPATH: "",
|
OriGOPATH: "",
|
||||||
}
|
}
|
||||||
placeToInstall, err := b.findWhereToInstall()
|
placeToInstall, err := b.findWhereToInstall()
|
||||||
|
assert.NoError(t, err)
|
||||||
expectedPlace := filepath.Join(os.Getenv("HOME"), "go", "bin")
|
expectedPlace := filepath.Join(os.Getenv("HOME"), "go", "bin")
|
||||||
assert.Equal(t, placeToInstall, expectedPlace)
|
assert.Equal(t, placeToInstall, expectedPlace)
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ func TestClientAction(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, item := range profileItems {
|
for _, item := range profileItems {
|
||||||
// init server
|
// init server
|
||||||
res, err := client.InitSystem()
|
_, err = client.InitSystem()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
// register server
|
// register server
|
||||||
res, err = client.RegisterService(item.service)
|
res, err = client.RegisterService(item.service)
|
||||||
@ -122,7 +122,7 @@ func TestClientAction(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// init system and check service again
|
// init system and check service again
|
||||||
res, err = client.InitSystem()
|
_, err = client.InitSystem()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
res, err = client.ListServices()
|
res, err = client.ListServices()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
@ -18,6 +18,7 @@ package cover
|
|||||||
|
|
||||||
import "sort"
|
import "sort"
|
||||||
|
|
||||||
|
// DeltaCov contains the info of a delta coverage
|
||||||
type DeltaCov struct {
|
type DeltaCov struct {
|
||||||
FileName string
|
FileName string
|
||||||
BasePer string
|
BasePer string
|
||||||
@ -26,9 +27,10 @@ type DeltaCov struct {
|
|||||||
LineCovLink string
|
LineCovLink string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeltaCovList is the list of DeltaCov
|
||||||
type DeltaCovList []DeltaCov
|
type DeltaCovList []DeltaCov
|
||||||
|
|
||||||
// get full delta coverage between new and base profile
|
// GetFullDeltaCov get full delta coverage between new and base profile
|
||||||
func GetFullDeltaCov(newList CoverageList, baseList CoverageList) (delta DeltaCovList) {
|
func GetFullDeltaCov(newList CoverageList, baseList CoverageList) (delta DeltaCovList) {
|
||||||
newMap := newList.Map()
|
newMap := newList.Map()
|
||||||
baseMap := baseList.Map()
|
baseMap := baseList.Map()
|
||||||
@ -64,7 +66,7 @@ func GetFullDeltaCov(newList CoverageList, baseList CoverageList) (delta DeltaCo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//get two profile diff cov
|
// GetDeltaCov get two profile diff cov
|
||||||
func GetDeltaCov(newList CoverageList, baseList CoverageList) (delta DeltaCovList) {
|
func GetDeltaCov(newList CoverageList, baseList CoverageList) (delta DeltaCovList) {
|
||||||
d := GetFullDeltaCov(newList, baseList)
|
d := GetFullDeltaCov(newList, baseList)
|
||||||
for _, v := range d {
|
for _, v := range d {
|
||||||
@ -76,7 +78,7 @@ func GetDeltaCov(newList CoverageList, baseList CoverageList) (delta DeltaCovLis
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//get two profile diff cov of changed files
|
// GetChFileDeltaCov get two profile diff cov of changed files
|
||||||
func GetChFileDeltaCov(newList CoverageList, baseList CoverageList, changedFiles []string) (list DeltaCovList) {
|
func GetChFileDeltaCov(newList CoverageList, baseList CoverageList, changedFiles []string) (list DeltaCovList) {
|
||||||
d := GetFullDeltaCov(newList, baseList)
|
d := GetFullDeltaCov(newList, baseList)
|
||||||
dMap := d.Map()
|
dMap := d.Map()
|
||||||
@ -88,14 +90,14 @@ func GetChFileDeltaCov(newList CoverageList, baseList CoverageList, changedFiles
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//calculate two coverage delta
|
// Delta calculate two coverage delta
|
||||||
func Delta(new Coverage, base Coverage) float32 {
|
func Delta(new Coverage, base Coverage) float32 {
|
||||||
baseRatio, _ := base.Ratio()
|
baseRatio, _ := base.Ratio()
|
||||||
newRatio, _ := new.Ratio()
|
newRatio, _ := new.Ratio()
|
||||||
return newRatio - baseRatio
|
return newRatio - baseRatio
|
||||||
}
|
}
|
||||||
|
|
||||||
//calculate two coverage delta
|
// TotalDelta calculate two coverage delta
|
||||||
func TotalDelta(new CoverageList, base CoverageList) float32 {
|
func TotalDelta(new CoverageList, base CoverageList) float32 {
|
||||||
baseRatio, _ := base.TotalRatio()
|
baseRatio, _ := base.TotalRatio()
|
||||||
newRatio, _ := new.TotalRatio()
|
newRatio, _ := new.TotalRatio()
|
||||||
@ -111,7 +113,7 @@ func (d DeltaCovList) Map() map[string]DeltaCov {
|
|||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort DeltaCovList with filenames
|
// Sort sort DeltaCovList with filenames
|
||||||
func (d DeltaCovList) Sort() {
|
func (d DeltaCovList) Sort() {
|
||||||
sort.SliceStable(d, func(i, j int) bool {
|
sort.SliceStable(d, func(i, j int) bool {
|
||||||
return d[i].Name() < d[j].Name()
|
return d[i].Name() < d[j].Name()
|
||||||
@ -123,10 +125,12 @@ func (c *DeltaCov) Name() string {
|
|||||||
return c.FileName
|
return c.FileName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetLineCovLink get the LineCovLink of the DeltaCov
|
||||||
func (c *DeltaCov) GetLineCovLink() string {
|
func (c *DeltaCov) GetLineCovLink() string {
|
||||||
return c.LineCovLink
|
return c.LineCovLink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetLineCovLink set LineCovLink of the DeltaCov
|
||||||
func (c *DeltaCov) SetLineCovLink(link string) {
|
func (c *DeltaCov) SetLineCovLink(link string) {
|
||||||
c.LineCovLink = link
|
c.LineCovLink = link
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ type PrComment interface {
|
|||||||
GetCommentFlag() string
|
GetCommentFlag() string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GithubPrComment is the entry which is able to comment on Github Pull Requests
|
// GitPrComment is the entry which is able to comment on Github Pull Requests
|
||||||
type GithubPrComment struct {
|
type GitPrComment struct {
|
||||||
RobotUserName string
|
RobotUserName string
|
||||||
RepoOwner string
|
RepoOwner string
|
||||||
RepoName string
|
RepoName string
|
||||||
@ -60,7 +60,7 @@ type GithubPrComment struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewPrClient creates an Client which be able to comment on Github Pull Request
|
// NewPrClient creates an Client which be able to comment on Github Pull Request
|
||||||
func NewPrClient(githubTokenPath, repoOwner, repoName, prNumStr, botUserName, commentFlag string) *GithubPrComment {
|
func NewPrClient(githubTokenPath, repoOwner, repoName, prNumStr, botUserName, commentFlag string) *GitPrComment {
|
||||||
var client *github.Client
|
var client *github.Client
|
||||||
|
|
||||||
// performs automatic retries when connection error occurs or a 500-range response code received (except 501)
|
// performs automatic retries when connection error occurs or a 500-range response code received (except 501)
|
||||||
@ -81,7 +81,7 @@ func NewPrClient(githubTokenPath, repoOwner, repoName, prNumStr, botUserName, co
|
|||||||
tc := oauth2.NewClient(ctx, ts)
|
tc := oauth2.NewClient(ctx, ts)
|
||||||
client = github.NewClient(tc)
|
client = github.NewClient(tc)
|
||||||
|
|
||||||
return &GithubPrComment{
|
return &GitPrComment{
|
||||||
RobotUserName: botUserName,
|
RobotUserName: botUserName,
|
||||||
RepoOwner: repoOwner,
|
RepoOwner: repoOwner,
|
||||||
RepoName: repoName,
|
RepoName: repoName,
|
||||||
@ -94,7 +94,7 @@ func NewPrClient(githubTokenPath, repoOwner, repoName, prNumStr, botUserName, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateGithubComment post github comment of diff coverage
|
// CreateGithubComment post github comment of diff coverage
|
||||||
func (c *GithubPrComment) CreateGithubComment(commentPrefix string, diffCovList cover.DeltaCovList) (err error) {
|
func (c *GitPrComment) CreateGithubComment(commentPrefix string, diffCovList cover.DeltaCovList) (err error) {
|
||||||
if len(diffCovList) == 0 {
|
if len(diffCovList) == 0 {
|
||||||
logrus.Printf("Detect 0 files coverage diff, will not comment to github.")
|
logrus.Printf("Detect 0 files coverage diff, will not comment to github.")
|
||||||
return nil
|
return nil
|
||||||
@ -110,7 +110,7 @@ func (c *GithubPrComment) CreateGithubComment(commentPrefix string, diffCovList
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PostComment post comment on github. It erased the old one if existed to avoid duplicate
|
// PostComment post comment on github. It erased the old one if existed to avoid duplicate
|
||||||
func (c *GithubPrComment) PostComment(content, commentPrefix string) error {
|
func (c *GitPrComment) PostComment(content, commentPrefix string) error {
|
||||||
//step1: erase history similar comment to avoid too many comment for same job
|
//step1: erase history similar comment to avoid too many comment for same job
|
||||||
err := c.EraseHistoryComment(commentPrefix)
|
err := c.EraseHistoryComment(commentPrefix)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -130,7 +130,7 @@ func (c *GithubPrComment) PostComment(content, commentPrefix string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EraseHistoryComment erase history similar comment before post again
|
// EraseHistoryComment erase history similar comment before post again
|
||||||
func (c *GithubPrComment) EraseHistoryComment(commentPrefix string) error {
|
func (c *GitPrComment) EraseHistoryComment(commentPrefix string) error {
|
||||||
comments, _, err := c.GithubClient.Issues.ListComments(c.Ctx, c.RepoOwner, c.RepoName, c.PrNumber, nil)
|
comments, _, err := c.GithubClient.Issues.ListComments(c.Ctx, c.RepoOwner, c.RepoName, c.PrNumber, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("list PR comments failed.")
|
logrus.Errorf("list PR comments failed.")
|
||||||
@ -152,7 +152,7 @@ func (c *GithubPrComment) EraseHistoryComment(commentPrefix string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetPrChangedFiles get github pull request changes file list
|
// GetPrChangedFiles get github pull request changes file list
|
||||||
func (c *GithubPrComment) GetPrChangedFiles() (files []string, err error) {
|
func (c *GitPrComment) GetPrChangedFiles() (files []string, err error) {
|
||||||
var commitFiles []*github.CommitFile
|
var commitFiles []*github.CommitFile
|
||||||
for {
|
for {
|
||||||
f, resp, err := c.GithubClient.PullRequests.ListFiles(c.Ctx, c.RepoOwner, c.RepoName, c.PrNumber, c.opt)
|
f, resp, err := c.GithubClient.PullRequests.ListFiles(c.Ctx, c.RepoOwner, c.RepoName, c.PrNumber, c.opt)
|
||||||
@ -174,8 +174,8 @@ func (c *GithubPrComment) GetPrChangedFiles() (files []string, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCommentFlag get CommentFlag from the GithubPrComment
|
// GetCommentFlag get CommentFlag from the GitPrComment
|
||||||
func (c *GithubPrComment) GetCommentFlag() string {
|
func (c *GitPrComment) GetCommentFlag() string {
|
||||||
return c.CommentFlag
|
return c.CommentFlag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ func TestCreateGithubComment(t *testing.T) {
|
|||||||
router.HandlerFunc("DELETE", "/repos/qiniu/goc/issues/comments/1", func(w http.ResponseWriter, r *http.Request) {
|
router.HandlerFunc("DELETE", "/repos/qiniu/goc/issues/comments/1", func(w http.ResponseWriter, r *http.Request) {
|
||||||
})
|
})
|
||||||
|
|
||||||
p := GithubPrComment{
|
p := GitPrComment{
|
||||||
RobotUserName: "qiniu-bot",
|
RobotUserName: "qiniu-bot",
|
||||||
RepoOwner: "qiniu",
|
RepoOwner: "qiniu",
|
||||||
RepoName: "goc",
|
RepoName: "goc",
|
||||||
@ -136,7 +136,7 @@ func TestCreateGithubComment(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateGithubCommentError(t *testing.T) {
|
func TestCreateGithubCommentError(t *testing.T) {
|
||||||
p := &GithubPrComment{}
|
p := &GitPrComment{}
|
||||||
err := p.CreateGithubComment("", cover.DeltaCovList{})
|
err := p.CreateGithubComment("", cover.DeltaCovList{})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ func TestGetPrChangedFiles(t *testing.T) {
|
|||||||
fmt.Fprint(w, `[{"filename":"src/qiniu.com/kodo/s3apiv2/bucket/bucket.go"}]`)
|
fmt.Fprint(w, `[{"filename":"src/qiniu.com/kodo/s3apiv2/bucket/bucket.go"}]`)
|
||||||
})
|
})
|
||||||
|
|
||||||
p := GithubPrComment{
|
p := GitPrComment{
|
||||||
RobotUserName: "qiniu-bot",
|
RobotUserName: "qiniu-bot",
|
||||||
RepoOwner: "qiniu",
|
RepoOwner: "qiniu",
|
||||||
RepoName: "goc",
|
RepoName: "goc",
|
||||||
@ -168,7 +168,7 @@ func TestGetPrChangedFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetCommentFlag(t *testing.T) {
|
func TestGetCommentFlag(t *testing.T) {
|
||||||
p := GithubPrComment{
|
p := GitPrComment{
|
||||||
CommentFlag: "flag",
|
CommentFlag: "flag",
|
||||||
}
|
}
|
||||||
flag := p.GetCommentFlag()
|
flag := p.GetCommentFlag()
|
||||||
|
@ -144,7 +144,7 @@ func trimGhFileToProfile(ghFiles []string) (pFiles []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter local profile with changed files and save to j.LocalArtifacts.ChangedProfileName
|
// WriteChangedCov filter local profile with changed files and save to j.LocalArtifacts.ChangedProfileName
|
||||||
func (j *Job) WriteChangedCov(changedFiles []string) error {
|
func (j *Job) WriteChangedCov(changedFiles []string) error {
|
||||||
p, err := ioutil.ReadFile(j.LocalProfilePath)
|
p, err := ioutil.ReadFile(j.LocalProfilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -175,14 +175,17 @@ func writeLine(file *os.File, content string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JobPrefixOnQiniu generates the prefix string of the job on qiniu
|
||||||
func (j *Job) JobPrefixOnQiniu() string {
|
func (j *Job) JobPrefixOnQiniu() string {
|
||||||
return path.Join("pr-logs", "pull", j.Org+"_"+j.RepoName, j.PRNumStr, j.JobName, j.BuildId)
|
return path.Join("pr-logs", "pull", j.Org+"_"+j.RepoName, j.PRNumStr, j.JobName, j.BuildId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HtmlProfile generates the name of the profile html file
|
||||||
func (j *Job) HtmlProfile() string {
|
func (j *Job) HtmlProfile() string {
|
||||||
return fmt.Sprintf("%s-%s-pr%s-coverage.html", j.Org, j.RepoName, j.PRNumStr)
|
return fmt.Sprintf("%s-%s-pr%s-coverage.html", j.Org, j.RepoName, j.PRNumStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetDeltaCovLinks set DeltaCovLinks to the job
|
||||||
func (j *Job) SetDeltaCovLinks(c cover.DeltaCovList) {
|
func (j *Job) SetDeltaCovLinks(c cover.DeltaCovList) {
|
||||||
c.Sort()
|
c.Sort()
|
||||||
for i := 0; i < len(c); i++ {
|
for i := 0; i < len(c); i++ {
|
||||||
|
@ -139,12 +139,14 @@ func (q *QnClient) GetAccessURL(key string, timeout time.Duration) string {
|
|||||||
return storage.MakePrivateURL(qbox.NewMac(q.cfg.AccessKey, q.cfg.SecretKey), q.cfg.Domain, key, deadline)
|
return storage.MakePrivateURL(qbox.NewMac(q.cfg.AccessKey, q.cfg.SecretKey), q.cfg.Domain, key, deadline)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LogHistoryTemplate is the template of the log history
|
||||||
type LogHistoryTemplate struct {
|
type LogHistoryTemplate struct {
|
||||||
BucketName string
|
BucketName string
|
||||||
KeyPath string
|
KeyPath string
|
||||||
Items []logHistoryItem
|
Items []logHistoryItem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// logHistoryItem represents a log history item
|
||||||
type logHistoryItem struct {
|
type logHistoryItem struct {
|
||||||
Name string
|
Name string
|
||||||
Size string
|
Size string
|
||||||
@ -152,7 +154,7 @@ type logHistoryItem struct {
|
|||||||
Url string
|
Url string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Artifacts lists all artifacts available for the given job source
|
// GetArtifactDetails lists all artifacts available for the given job source
|
||||||
func (q *QnClient) GetArtifactDetails(key string) (*LogHistoryTemplate, error) {
|
func (q *QnClient) GetArtifactDetails(key string) (*LogHistoryTemplate, error) {
|
||||||
tmpl := new(LogHistoryTemplate)
|
tmpl := new(LogHistoryTemplate)
|
||||||
item := logHistoryItem{}
|
item := logHistoryItem{}
|
||||||
@ -193,6 +195,7 @@ func timeConv(ptime int64) string {
|
|||||||
return tm.Format("2006-01-02 03:04:05 PM")
|
return tm.Format("2006-01-02 03:04:05 PM")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListSubDirs list all the sub directions of the prefix string in qiniu client
|
||||||
func (q *QnClient) ListSubDirs(prefix string) ([]string, error) {
|
func (q *QnClient) ListSubDirs(prefix string) ([]string, error) {
|
||||||
var dirs []string
|
var dirs []string
|
||||||
var marker string
|
var marker string
|
||||||
|
@ -98,7 +98,7 @@ func MockRouterListAllAPI(router *httprouter.Router, count int) {
|
|||||||
logrus.Infof("request url is: %s", r.URL.String())
|
logrus.Infof("request url is: %s", r.URL.String())
|
||||||
|
|
||||||
if timeout > 0 {
|
if timeout > 0 {
|
||||||
timeout -= 1
|
timeout--
|
||||||
http.Error(w, "not found", http.StatusNotFound)
|
http.Error(w, "not found", http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ func MockPrivateDomainUrl(router *httprouter.Router, count int) {
|
|||||||
logrus.Infof("request url is: %s", r.URL.String())
|
logrus.Infof("request url is: %s", r.URL.String())
|
||||||
|
|
||||||
if timeout1 > 0 {
|
if timeout1 > 0 {
|
||||||
timeout1 -= 1
|
timeout1--
|
||||||
http.Error(w, "not found", http.StatusNotFound)
|
http.Error(w, "not found", http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ func MockPrivateDomainUrl(router *httprouter.Router, count int) {
|
|||||||
logrus.Infof("request url is: %s", r.URL.String())
|
logrus.Infof("request url is: %s", r.URL.String())
|
||||||
|
|
||||||
if timeout2 > 0 {
|
if timeout2 > 0 {
|
||||||
timeout2 -= 1
|
timeout2--
|
||||||
if timeout2%2 == 0 {
|
if timeout2%2 == 0 {
|
||||||
http.Error(w, "not found", 571)
|
http.Error(w, "not found", 571)
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,6 +54,7 @@ func TestNewRangeReader(t *testing.T) {
|
|||||||
assert.Equal(t, err, nil)
|
assert.Equal(t, err, nil)
|
||||||
|
|
||||||
bodyBytes, err := ioutil.ReadAll(body)
|
bodyBytes, err := ioutil.ReadAll(body)
|
||||||
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, string(bodyBytes), "mock server ok")
|
assert.Equal(t, string(bodyBytes), "mock server ok")
|
||||||
|
|
||||||
// test with HEAD method
|
// test with HEAD method
|
||||||
@ -61,6 +62,7 @@ func TestNewRangeReader(t *testing.T) {
|
|||||||
assert.Equal(t, err, nil)
|
assert.Equal(t, err, nil)
|
||||||
|
|
||||||
bodyBytes, err = ioutil.ReadAll(body)
|
bodyBytes, err = ioutil.ReadAll(body)
|
||||||
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, string(bodyBytes), "")
|
assert.Equal(t, string(bodyBytes), "")
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -92,6 +94,7 @@ func TestNewRangeReaderWithTimeoutAndRecover(t *testing.T) {
|
|||||||
assert.Equal(t, err, nil)
|
assert.Equal(t, err, nil)
|
||||||
|
|
||||||
bodyBytes, err := ioutil.ReadAll(body)
|
bodyBytes, err := ioutil.ReadAll(body)
|
||||||
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, string(bodyBytes), "mock server ok")
|
assert.Equal(t, string(bodyBytes), "mock server ok")
|
||||||
|
|
||||||
// test with retry with statuscode=571, 573
|
// test with retry with statuscode=571, 573
|
||||||
@ -100,6 +103,7 @@ func TestNewRangeReaderWithTimeoutAndRecover(t *testing.T) {
|
|||||||
assert.Equal(t, err, nil)
|
assert.Equal(t, err, nil)
|
||||||
|
|
||||||
bodyBytes, err = ioutil.ReadAll(body)
|
bodyBytes, err = ioutil.ReadAll(body)
|
||||||
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, string(bodyBytes), "mock server ok")
|
assert.Equal(t, string(bodyBytes), "mock server ok")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"example.com/multi-mains-project/foo/internal/qiniu"
|
"example.com/multi-mains-project/foo/internal/qiniu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Bar1 is a sample service
|
||||||
func Bar1() {
|
func Bar1() {
|
||||||
internal.Xiaohong()
|
internal.Xiaohong()
|
||||||
qiniu.BB()
|
qiniu.BB()
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"example.com/multi-mains-project/foo/internal/qiniu"
|
"example.com/multi-mains-project/foo/internal/qiniu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Bar2 is a sample service
|
||||||
func Bar2() {
|
func Bar2() {
|
||||||
internal.Xiaohong()
|
internal.Xiaohong()
|
||||||
qiniu.BB()
|
qiniu.BB()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package qiniu
|
package qiniu
|
||||||
|
|
||||||
|
// BB is a internal function
|
||||||
func BB() {
|
func BB() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
|
// Xiaohong is a internal sample function
|
||||||
func Xiaohong() {
|
func Xiaohong() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package internal
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
// Hello is a internal function
|
||||||
func Hello() {
|
func Hello() {
|
||||||
fmt.Println("hello, world.")
|
fmt.Println("hello, world.")
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package modulea
|
package modulea
|
||||||
|
|
||||||
|
// Bar is a sample service
|
||||||
func Bar() {
|
func Bar() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"example.com/simple-project/foo/internal/qiniu"
|
"example.com/simple-project/foo/internal/qiniu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Bar1 is a sample service
|
||||||
func Bar1() {
|
func Bar1() {
|
||||||
internal.Xiaohong()
|
internal.Xiaohong()
|
||||||
qiniu.BB()
|
qiniu.BB()
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"example.com/simple-project/foo/internal/qiniu"
|
"example.com/simple-project/foo/internal/qiniu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Bar2 is a sample service
|
||||||
func Bar2() {
|
func Bar2() {
|
||||||
internal.Xiaohong()
|
internal.Xiaohong()
|
||||||
qiniu.BB()
|
qiniu.BB()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package qiniu
|
package qiniu
|
||||||
|
|
||||||
|
// BB is a internal function
|
||||||
func BB() {
|
func BB() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
|
// Xiaohong is a internal function
|
||||||
func Xiaohong() {
|
func Xiaohong() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package internal
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
// Hello is a internal function
|
||||||
func Hello() {
|
func Hello() {
|
||||||
fmt.Println("hello, world.")
|
fmt.Println("hello, world.")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user