diff --git a/.goreleaser.yml b/.goreleaser.yml index 5f2bc342..37941d97 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -11,10 +11,12 @@ changelog: skip: true builds: -- main: ./nats-streaming-server.go +- main: . binary: nats-streaming-server + flags: + - -trimpath ldflags: - - -w -X github.com/nats-io/nats-streaming-server/server.gitCommit={{.ShortCommit}} -X github.com/nats-io/nats-server/v2/server.gitCommit=23ffc16 + - -w -X github.com/nats-io/nats-streaming-server/server.gitCommit={{.ShortCommit}} -X github.com/nats-io/nats-server/v2/server.gitCommit=f84ca24 env: - GO111MODULE=on - CGO_ENABLED=0 @@ -47,14 +49,12 @@ nfpms: archives: - name_template: '{{.ProjectName}}-{{.Tag}}-{{.Os}}-{{.Arch}}{{if .Arm}}{{.Arm}}{{end}}' - rlcp: true wrap_in_directory: true format: zip files: - README.md - LICENSE - name_template: '{{.ProjectName}}-{{.Tag}}-{{.Os}}-{{.Arch}}{{if .Arm}}{{.Arm}}{{end}}' - rlcp: true id: targz-archives wrap_in_directory: true format: tar.gz diff --git a/README.md b/README.md index 73e96884..9bc56a47 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,6 @@ under the Apache Version 2.0 license found in the LICENSE file. [Coverage-image]: https://coveralls.io/repos/github/nats-io/nats-streaming-server/badge.svg?branch=main&t=kIxrDE [ReportCard-Url]: http://goreportcard.com/report/nats-io/nats-streaming-server [ReportCard-Image]: http://goreportcard.com/badge/github.com/nats-io/nats-streaming-server -[Release-Url]: https://github.com/nats-io/nats-streaming-server/releases/tag/v0.25.3 -[Release-image]: https://img.shields.io/badge/release-v0.25.3-1eb0fc.svg +[Release-Url]: https://github.com/nats-io/nats-streaming-server/releases/tag/v0.25.4 +[Release-image]: https://img.shields.io/badge/release-v0.25.4-1eb0fc.svg [github-release]: https://github.com/nats-io/nats-streaming-server/releases/ diff --git a/go.mod b/go.mod index 5ae01261..16b3bdda 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nats-io/nats-streaming-server -go 1.14 +go 1.19 require ( github.com/go-sql-driver/mysql v1.7.0 @@ -8,13 +8,28 @@ require ( github.com/hashicorp/go-hclog v1.5.0 github.com/hashicorp/go-msgpack/v2 v2.1.0 github.com/hashicorp/raft v1.4.0 - github.com/lib/pq v1.10.7 - github.com/nats-io/nats-server/v2 v2.9.15 + github.com/lib/pq v1.10.8 + github.com/nats-io/nats-server/v2 v2.9.16 github.com/nats-io/nats.go v1.25.0 github.com/nats-io/nuid v1.0.1 github.com/nats-io/stan.go v0.10.4 - github.com/prometheus/procfs v0.8.0 - go.etcd.io/bbolt v1.3.6 - golang.org/x/crypto v0.6.0 - golang.org/x/sys v0.5.0 + github.com/prometheus/procfs v0.9.0 + go.etcd.io/bbolt v1.3.7 + golang.org/x/crypto v0.8.0 + golang.org/x/sys v0.7.0 +) + +require ( + github.com/armon/go-metrics v0.4.1 // indirect + github.com/fatih/color v1.13.0 // indirect + github.com/hashicorp/go-immutable-radix v1.0.0 // indirect + github.com/hashicorp/go-msgpack v0.5.5 // indirect + github.com/hashicorp/golang-lru v0.5.0 // indirect + github.com/klauspost/compress v1.16.4 // indirect + github.com/mattn/go-colorable v0.1.12 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/minio/highwayhash v1.0.2 // indirect + github.com/nats-io/jwt/v2 v2.4.1 // indirect + github.com/nats-io/nkeys v0.4.4 // indirect + golang.org/x/time v0.3.0 // indirect ) diff --git a/go.sum b/go.sum index 9f463932..0b85328b 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,4 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/Sereal/Sereal v0.0.0-20221130110801-16a4f76670cd/go.mod h1:D0JMgToj/WdxCgd30Kc1UcA9E+WdZoJqeVOuYW7iTBM= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -16,7 +14,6 @@ github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp 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/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892/go.mod h1:CTDl0pzVzE5DEzZhPfvhY/9sPFMQIxaJ9VAMs9AagrE= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= @@ -32,23 +29,10 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= @@ -67,26 +51,20 @@ github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCO github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/raft v1.4.0 h1:tn28S/AWv0BtRQgwZv/1NELu8sCvI0FixqL8C8MYKeY= github.com/hashicorp/raft v1.4.0/go.mod h1:nz64BIjXphDLATfKGG5RzHtNUPioLeKFsXEm88yTVew= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4= -github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.4 h1:91KN02FnsOYhuunwU4ssRe8lc2JosWmizWa91B5v1PU= +github.com/klauspost/compress v1.16.4/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/lib/pq v1.10.8 h1:3fdt97i/cwSU83+E0hZTC/Xpc9mTZxc6UWSCRcSbxiE= +github.com/lib/pq v1.10.8/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= @@ -100,14 +78,12 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nats-io/jwt/v2 v2.3.0 h1:z2mA1a7tIf5ShggOFlR1oBPgd6hGqcDYsISxZByUzdI= -github.com/nats-io/jwt/v2 v2.3.0/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k= -github.com/nats-io/nats-server/v2 v2.9.15 h1:MuwEJheIwpvFgqvbs20W8Ish2azcygjf4Z0liVu2I4c= -github.com/nats-io/nats-server/v2 v2.9.15/go.mod h1:QlCTy115fqpx4KSOPFIxSV7DdI6OxtZsGOL1JLdeRlE= +github.com/nats-io/jwt/v2 v2.4.1 h1:Y35W1dgbbz2SQUYDPCaclXcuqleVmpbRa7646Jf2EX4= +github.com/nats-io/jwt/v2 v2.4.1/go.mod h1:24BeQtRwxRV8ruvC4CojXlx/WQ/VjuwlYiH+vu/+ibI= +github.com/nats-io/nats-server/v2 v2.9.16 h1:SuNe6AyCcVy0g5326wtyU8TdqYmcPqzTjhkHojAjprc= +github.com/nats-io/nats-server/v2 v2.9.16/go.mod h1:z1cc5Q+kqJkz9mLUdlcSsdYnId4pyImHjNgoh6zxSC0= github.com/nats-io/nats.go v1.22.1/go.mod h1:tLqubohF7t4z3du1QDPYJIQQyhb4wl6DhjxEajSI7UA= -github.com/nats-io/nats.go v1.24.0/go.mod h1:dVQF+BK3SzUZpwyzHedXsvH3EO38aVKuOPkkHlv5hXA= github.com/nats-io/nats.go v1.25.0 h1:t5/wCPGciR7X3Mu8QOi4jiJaXaWM8qtkLu4lzGZvYHE= github.com/nats-io/nats.go v1.25.0/go.mod h1:D2WALIhz7V8M0pH8Scx8JZXlg6Oqz5VG+nQkK8nJdvg= github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= @@ -119,13 +95,10 @@ github.com/nats-io/stan.go v0.10.4 h1:19GS/eD1SeQJaVkeM9EkvEYattnvnWrZ3wkSWSw4uX github.com/nats-io/stan.go v0.10.4/go.mod h1:3XJXH8GagrGqajoO/9+HgPyKV5MWsv7S5ccdda+pc6k= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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/pquerna/ffjson v0.0.0-20190930134022-aa0246cd15f7/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M= -github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= @@ -137,8 +110,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -148,20 +121,17 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.uber.org/automaxprocs v1.5.1/go.mod h1:BF4eumQw0P9GtnuxxovUd06vwm1o18oMzFtK66vU6XU= +go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= +go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -169,32 +139,26 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= 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/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/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-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/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-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -204,7 +168,6 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -213,61 +176,35 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= 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-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/vmihailenco/msgpack.v2 v2.9.2/go.mod h1:/3Dn1Npt9+MYyLpYYXjInO/5jvMLamn+AEGwNEOatn8= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/logger/logger_test.go b/logger/logger_test.go index f22f8211..9111c0a2 100644 --- a/logger/logger_test.go +++ b/logger/logger_test.go @@ -17,7 +17,6 @@ import ( "errors" "flag" "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -177,7 +176,7 @@ func TestLogger(t *testing.T) { checkLogger("Unable to close logger: dummy error") // Switch to file log - tmpDir, err := ioutil.TempDir("", "") + tmpDir, err := os.MkdirTemp("", "") if err != nil { t.Fatalf("Unable to create temp dir: %v", err) } @@ -188,7 +187,7 @@ func TestLogger(t *testing.T) { logger.SetFileSizeLimit(1000) // Reopen and check file content logger.ReopenLogFile() - buf, err := ioutil.ReadFile(fname) + buf, err := os.ReadFile(fname) if err != nil { t.Fatalf("Error reading file: %v", err) } @@ -201,7 +200,7 @@ func TestLogger(t *testing.T) { for i := 0; i < 100; i++ { logger.Noticef(notice) } - files, err := ioutil.ReadDir(tmpDir) + files, err := os.ReadDir(tmpDir) if err != nil { t.Fatalf("Unable to read temp dir: %v", err) } diff --git a/server/clustering_test.go b/server/clustering_test.go index 9b6f7b13..528db6c4 100644 --- a/server/clustering_test.go +++ b/server/clustering_test.go @@ -18,7 +18,6 @@ import ( "database/sql" "encoding/json" "fmt" - "io/ioutil" "math/rand" "net" "net/http" @@ -46,7 +45,7 @@ import ( var defaultRaftLog string func init() { - tmpDir, err := ioutil.TempDir("", "raft_logs_") + tmpDir, err := os.MkdirTemp("", "raft_logs_") if err != nil { panic("Could not create tmp dir") } @@ -3679,7 +3678,7 @@ func TestClusteringRaftLogReplayDoesNotDeleteLatestVersionOfChannel(t *testing.T follower := removeServer(servers, leader)[0] follower.Shutdown() witnessFile := filepath.Join(follower.opts.FilestoreDir, channel, "deleted.txt") - if err := ioutil.WriteFile(witnessFile, []byte("if present, channel has not been deleted then recreated"), 0666); err != nil { + if err := os.WriteFile(witnessFile, []byte("if present, channel has not been deleted then recreated"), 0666); err != nil { t.Fatalf("Error creating file: %v", err) } // Now restart.. @@ -4551,7 +4550,7 @@ func TestClusteringWithCryptoStore(t *testing.T) { check := func(t *testing.T, name, fname string) { t.Helper() - content, err := ioutil.ReadFile(fname) + content, err := os.ReadFile(fname) if err != nil { t.Fatalf("Error reading file %q: %v", fname1, err) } @@ -6770,7 +6769,7 @@ func TestClusteringRestoreSnapshotMsgsBailIfNoLeader(t *testing.T) { return nil }) - snaps, err := ioutil.ReadDir(filepath.Join(defaultRaftLog, "c", clusterName, "snapshots")) + snaps, err := os.ReadDir(filepath.Join(defaultRaftLog, "c", clusterName, "snapshots")) if err != nil { t.Fatalf("Error reading snapshots directory: %v", err) } diff --git a/server/conf_test.go b/server/conf_test.go index e54e1631..395d6486 100644 --- a/server/conf_test.go +++ b/server/conf_test.go @@ -16,7 +16,6 @@ package server import ( "bytes" "flag" - "io/ioutil" "os" "reflect" "runtime" @@ -314,11 +313,11 @@ func TestParsePermError(t *testing.T) { if runtime.GOOS == "windows" { t.SkipNow() } - tmpDir, err := ioutil.TempDir("", "streaming") + tmpDir, err := os.MkdirTemp("", "streaming") if err != nil { t.Fatalf("Could not create tmp dir: %v", err) } - file, err := ioutil.TempFile(tmpDir, "config.conf") + file, err := os.CreateTemp(tmpDir, "config.conf") if err != nil { t.Fatalf("Could not create tmp file: %v", err) } @@ -339,7 +338,7 @@ func TestParsePermError(t *testing.T) { func TestParseParserError(t *testing.T) { confFile := "wrong_config.conf" - if err := ioutil.WriteFile(confFile, []byte("x=."), 0660); err != nil { + if err := os.WriteFile(confFile, []byte("x=."), 0660); err != nil { t.Fatalf("Unexpected error creating conf file: %v", err) } defer os.Remove(confFile) @@ -351,7 +350,7 @@ func TestParseParserError(t *testing.T) { func TestParseStoreType(t *testing.T) { confFile := "wrong_config.conf" - if err := ioutil.WriteFile(confFile, []byte("store=memory"), 0660); err != nil { + if err := os.WriteFile(confFile, []byte("store=memory"), 0660); err != nil { t.Fatalf("Unexpected error creating conf file: %v", err) } defer os.Remove(confFile) @@ -364,7 +363,7 @@ func TestParseStoreType(t *testing.T) { } os.Remove(confFile) - if err := ioutil.WriteFile(confFile, []byte("store=xyz"), 0660); err != nil { + if err := os.WriteFile(confFile, []byte("store=xyz"), 0660); err != nil { t.Fatalf("Unexpected error creating conf file: %v", err) } defer os.Remove(confFile) @@ -380,7 +379,7 @@ func TestParseStoreType(t *testing.T) { stores.TypeSQL, } for _, gs := range goodStores { - if err := ioutil.WriteFile(confFile, []byte("store="+gs), 0660); err != nil { + if err := os.WriteFile(confFile, []byte("store="+gs), 0660); err != nil { t.Fatalf("Unexpected error creating conf file: %v", err) } defer os.Remove(confFile) @@ -398,7 +397,7 @@ func TestParseStoreType(t *testing.T) { func TestParsePerChannelLimitsSetToZero(t *testing.T) { confFile := "config.conf" defer os.Remove(confFile) - if err := ioutil.WriteFile(confFile, + if err := os.WriteFile(confFile, []byte("store_limits: {channels: {foo: {max_msgs: 0, max_bytes: 0, max_age: \"0\", max_subs: 0, max_inactivity: \"0\"}}}"), 0660); err != nil { t.Fatalf("Unexpected error creating conf file: %v", err) } @@ -532,7 +531,7 @@ func TestParseWrongTypes(t *testing.T) { func expectFailureFor(t *testing.T, content, errorMatch string) { confFile := "wrong_config.conf" - if err := ioutil.WriteFile(confFile, []byte(content), 0660); err != nil { + if err := os.WriteFile(confFile, []byte(content), 0660); err != nil { t.Fatalf("Unexpected error creating conf file: %v", err) } defer os.Remove(confFile) @@ -637,7 +636,7 @@ func TestParseConfigureOptions(t *testing.T) { streaming: { cluster_id: my_cluster }`) - if err := ioutil.WriteFile(sconf, scontent, 0660); err != nil { + if err := os.WriteFile(sconf, scontent, 0660); err != nil { t.Fatalf("Error creating conf file: %v", err) } ncontent := []byte(` @@ -645,7 +644,7 @@ func TestParseConfigureOptions(t *testing.T) { streaming: { cluster_id: my_cluster_2 }`) - if err := ioutil.WriteFile(nconf, ncontent, 0660); err != nil { + if err := os.WriteFile(nconf, ncontent, 0660); err != nil { t.Fatalf("Error creating conf file: %v", err) } sopts, nopts := mustNotFail([]string{"-sc", sconf, "-c", nconf}) @@ -700,7 +699,7 @@ func TestParseConfigureOptions(t *testing.T) { } else { ncontent = []byte(`logtime: true`) } - if err := ioutil.WriteFile(nconf, ncontent, 0660); err != nil { + if err := os.WriteFile(nconf, ncontent, 0660); err != nil { t.Fatalf("Error creating conf file: %v", err) } _, nopts = mustNotFail([]string{"-c", nconf}) diff --git a/server/monitor_test.go b/server/monitor_test.go index be9fda5f..4af7f459 100644 --- a/server/monitor_test.go +++ b/server/monitor_test.go @@ -18,9 +18,10 @@ import ( "crypto/x509" "encoding/json" "fmt" - "io/ioutil" + "io" "math/rand" "net/http" + "os" "reflect" "runtime" "strings" @@ -81,7 +82,7 @@ func getBodyEx(t *testing.T, client *http.Client, scheme, endpoint string, mp, e if ct != expectedContentType { stackFatalf(t, "Expected %s content-type, got %s\n", expectedContentType, ct) } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { resp.Body.Close() stackFatalf(t, "Got an error reading the body: %v\n", err) @@ -155,7 +156,7 @@ func TestMonitorStartOwnHTTPSServer(t *testing.T) { defer s.Shutdown() tlsConfig := &tls.Config{} - caCert, err := ioutil.ReadFile("../test/certs/ca.pem") + caCert, err := os.ReadFile("../test/certs/ca.pem") if err != nil { t.Fatalf("Got error reading RootCA file: %s", err) } @@ -1494,7 +1495,7 @@ func TestMonitorNoPanicOnServerRestart(t *testing.T) { if err != nil { continue } - ioutil.ReadAll(resp.Body) + io.ReadAll(resp.Body) resp.Body.Close() select { case <-done: diff --git a/server/server.go b/server/server.go index 500a1276..2d6b4f7c 100644 --- a/server/server.go +++ b/server/server.go @@ -47,7 +47,7 @@ import ( // Server defaults. const ( // VERSION is the current version for the NATS Streaming server. - VERSION = "0.25.3" + VERSION = "0.25.4" DefaultClusterID = "test-cluster" DefaultDiscoverPrefix = "_STAN.discover" diff --git a/server/server_run_test.go b/server/server_run_test.go index 4c942076..0b73527d 100644 --- a/server/server_run_test.go +++ b/server/server_run_test.go @@ -17,7 +17,6 @@ import ( "crypto/tls" "flag" "fmt" - "io/ioutil" "os" "reflect" "runtime" @@ -1283,12 +1282,12 @@ func TestStreamingServerReadyLog(t *testing.T) { } func TestReopenLogFileStopsNATSDebugTrace(t *testing.T) { - tmpDir, err := ioutil.TempDir("", "nats-streaming-server") + tmpDir, err := os.MkdirTemp("", "nats-streaming-server") if err != nil { t.Fatal("Could not create tmp dir") } defer os.RemoveAll(tmpDir) - file, err := ioutil.TempFile(tmpDir, "log_") + file, err := os.CreateTemp(tmpDir, "log_") if err != nil { t.Fatalf("Could not create the temp file: %v", err) } @@ -1311,7 +1310,7 @@ func TestReopenLogFileStopsNATSDebugTrace(t *testing.T) { check := func(str string, expected bool) { t.Helper() - buf, err := ioutil.ReadFile(nOpts.LogFile) + buf, err := os.ReadFile(nOpts.LogFile) if err != nil { t.Fatalf("Error reading file: %v", err) } @@ -1352,7 +1351,7 @@ func TestReopenLogFileStopsNATSDebugTrace(t *testing.T) { s.log.Noticef(pstr) } // Check that size limit has been applied. - files, err := ioutil.ReadDir(tmpDir) + files, err := os.ReadDir(tmpDir) if err != nil { t.Fatalf("Error reading directory: %v", err) } diff --git a/server/server_test.go b/server/server_test.go index 299f4a04..734547de 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -17,7 +17,6 @@ import ( "errors" "flag" "fmt" - "io/ioutil" "os" "reflect" "regexp" @@ -162,7 +161,7 @@ func TestMain(m *testing.M) { } func init() { - tmpDir, err := ioutil.TempDir(".", "data_server_") + tmpDir, err := os.MkdirTemp(".", "data_server_") if err != nil { panic("Could not create tmp dir") } @@ -409,13 +408,13 @@ func createConnectionWithNatsOpts(t tLogger, clientName string, func createConfFile(t *testing.T, content []byte) string { t.Helper() - conf, err := ioutil.TempFile("", "") + conf, err := os.CreateTemp("", "") if err != nil { t.Fatalf("Error creating conf file: %v", err) } fName := conf.Name() conf.Close() - if err := ioutil.WriteFile(fName, content, 0666); err != nil { + if err := os.WriteFile(fName, content, 0666); err != nil { os.Remove(fName) t.Fatalf("Error writing conf file: %v", err) } @@ -424,7 +423,7 @@ func createConfFile(t *testing.T, content []byte) string { func changeCurrentConfigContentWithNewContent(t *testing.T, curConfig string, content []byte) { t.Helper() - if err := ioutil.WriteFile(curConfig, content, 0666); err != nil { + if err := os.WriteFile(curConfig, content, 0666); err != nil { t.Fatalf("Error writing config: %v", err) } } diff --git a/server/signal_test.go b/server/signal_test.go index af7e9f93..026dc206 100644 --- a/server/signal_test.go +++ b/server/signal_test.go @@ -19,7 +19,6 @@ package server import ( "bytes" "fmt" - "io/ioutil" "os" "os/exec" "strings" @@ -77,7 +76,7 @@ func TestSignalToReOpenLogFile(t *testing.T) { // Add a trace expectedStr := "This is a Notice" s.log.Noticef(expectedStr) - buf, err := ioutil.ReadFile(logFile) + buf, err := os.ReadFile(logFile) if err != nil { t.Fatalf("Error reading file: %v", err) } @@ -92,7 +91,7 @@ func TestSignalToReOpenLogFile(t *testing.T) { syscall.Kill(syscall.Getpid(), syscall.SIGUSR1) // Wait a bit for action to be performed waitFor(t, 2*time.Second, 15*time.Millisecond, func() error { - buf, err = ioutil.ReadFile(logFile) + buf, err = os.ReadFile(logFile) if err != nil { return fmt.Errorf("Error reading file: %v", err) } @@ -105,7 +104,7 @@ func TestSignalToReOpenLogFile(t *testing.T) { // Make sure that new traces are added expectedStr = "This is a new notice" s.log.Noticef(expectedStr) - buf, err = ioutil.ReadFile(logFile) + buf, err = os.ReadFile(logFile) if err != nil { t.Fatalf("Error reading file: %v", err) } @@ -208,7 +207,7 @@ func TestNATSServerConfigReloadFollowedByReopen(t *testing.T) { cmd.Start() // Wait for it to print some startup trace waitFor(t, 2*time.Second, 50*time.Millisecond, func() error { - content, err := ioutil.ReadFile(lfile) + content, err := os.ReadFile(lfile) if err != nil { return err } @@ -230,7 +229,7 @@ func TestNATSServerConfigReloadFollowedByReopen(t *testing.T) { c.Close() syscall.Kill(cmd.Process.Pid, syscall.SIGINT) cmd.Wait() - content, err := ioutil.ReadFile(lfile) + content, err := os.ReadFile(lfile) if err != nil { t.Fatalf("Error reading log file: %v", err) } diff --git a/stores/cryptostore_test.go b/stores/cryptostore_test.go index 08f18576..9ef9bdd1 100644 --- a/stores/cryptostore_test.go +++ b/stores/cryptostore_test.go @@ -16,7 +16,6 @@ package stores import ( "bytes" "fmt" - "io/ioutil" "os" "reflect" "strings" @@ -240,7 +239,7 @@ func TestCryptoStoreUseEnvKey(t *testing.T) { cs.Close() - datContent, err := ioutil.ReadFile(datFile) + datContent, err := os.ReadFile(datFile) if err != nil { t.Fatalf("Error reading file: %v", err) } @@ -399,7 +398,7 @@ func TestCryptoStoreCheckEncryptedStore(t *testing.T) { s.Close() - datContent, err := ioutil.ReadFile(datFile) + datContent, err := os.ReadFile(datFile) if err != nil { t.Fatalf("Error reading file: %v", err) } @@ -411,7 +410,7 @@ func TestCryptoStoreCheckEncryptedStore(t *testing.T) { } // Only message store is encrypted, so subscription file // should be in plain text. - subContent, err := ioutil.ReadFile(subFile) + subContent, err := os.ReadFile(subFile) if err != nil { t.Fatalf("Error reading file: %v", err) } diff --git a/stores/filestore.go b/stores/filestore.go index 8c0f87e4..6c018618 100644 --- a/stores/filestore.go +++ b/stores/filestore.go @@ -19,7 +19,6 @@ import ( "fmt" "hash/crc32" "io" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -740,8 +739,10 @@ func checkFileVersion(r io.Reader) error { // writeRecord writes a record to `w`. // The record layout is as follows: -// 8 bytes: 4 bytes for type and/or size combined -// 4 bytes for CRC-32 +// 8 bytes: +// - 4 bytes for type and/or size combined +// - 4 bytes for CRC-32 +// // variable bytes: payload. // If a buffer is provided, this function uses it and expands it if necessary. // The function returns the buffer (possibly changed due to expansion) and the @@ -793,7 +794,7 @@ func writeRecord(w io.Writer, buf []byte, recType recordType, rec record, recSiz } // readRecord reads a record from `r`, possibly checking the CRC-32 checksum. -// When `buf`` is not nil, this function ensures the buffer is big enough to +// When `buf` is not nil, this function ensures the buffer is big enough to // hold the payload (expanding if necessary). Therefore, this call always // return `buf`, regardless if there is an error or not. // The caller is indicating if the record is supposed to be typed or not. @@ -1443,7 +1444,7 @@ func (fs *FileStore) Recover() (*RecoveredState, error) { } func (fs *FileStore) getChannelsDir() ([]os.FileInfo, error) { - files, err := ioutil.ReadDir(fs.fm.rootDir) + files, err := os.ReadDir(fs.fm.rootDir) if err != nil { return nil, err } @@ -1452,7 +1453,11 @@ func (fs *FileStore) getChannelsDir() ([]os.FileInfo, error) { if !f.IsDir() { continue } - channels = append(channels, f) + finfo, err := f.Info() + if err != nil { + return nil, err + } + channels = append(channels, finfo) } return channels, nil } @@ -1872,7 +1877,7 @@ func (fs *FileStore) compactClientFile(orgFileName string) error { // Return a temporary file (including file version) func getTempFile(rootDir, prefix string) (*os.File, error) { - tmpFile, err := ioutil.TempFile(rootDir, prefix) + tmpFile, err := os.CreateTemp(rootDir, prefix) if err != nil { return nil, err } @@ -2048,16 +2053,21 @@ func (fs *FileStore) newFileMsgStore(channelDirName, channel string, limits *Msg // Recovery case if doRecover { - var dirFiles []os.FileInfo + var dirEntries []os.DirEntry var fseq int64 var datFile, idxFile *file var useIdxFile bool - dirFiles, err = ioutil.ReadDir(channelDirName) - for _, file := range dirFiles { - if file.IsDir() { + dirEntries, err = os.ReadDir(channelDirName) + for _, entry := range dirEntries { + if entry.IsDir() { continue } + file, ierr := entry.Info() + if ierr != nil { + err = ierr + break + } fileName := file.Name() if !strings.HasPrefix(fileName, msgFilesPrefix) || !strings.HasSuffix(fileName, datSuffix) { continue diff --git a/stores/filestore_msg_test.go b/stores/filestore_msg_test.go index 592cf68c..82afc103 100644 --- a/stores/filestore_msg_test.go +++ b/stores/filestore_msg_test.go @@ -16,7 +16,6 @@ package stores import ( "fmt" "hash/crc32" - "io/ioutil" "os" "path/filepath" "reflect" @@ -83,11 +82,11 @@ func TestFSBadMsgFile(t *testing.T) { // Corrupt data file. Index's last message will not match // data file, so idx file will be removed and recovery from // data file will be done, which should report failure. - datContent, err := ioutil.ReadFile(firstSliceFileName) + datContent, err := os.ReadFile(firstSliceFileName) if err != nil { t.Fatalf("Error reading %v: %v", firstSliceFileName, err) } - if err := ioutil.WriteFile(firstSliceFileName, datContent[:len(datContent)-5], 0666); err != nil { + if err := os.WriteFile(firstSliceFileName, datContent[:len(datContent)-5], 0666); err != nil { t.Fatalf("Error writing file %v: %v", firstSliceFileName, err) } // So we should fail to create the filestore @@ -778,7 +777,7 @@ func TestFSArchiveScript(t *testing.T) { cleanupFSDatastore(t) defer cleanupFSDatastore(t) - tmpDir, err := ioutil.TempDir(".", "") + tmpDir, err := os.MkdirTemp(".", "") if err != nil { t.Fatalf("Unable to create temp dir: %v", err) } @@ -797,7 +796,7 @@ func TestFSArchiveScript(t *testing.T) { scriptFile = fmt.Sprintf("%s/script_%v.sh", pwd, time.Now().UnixNano()) content = fmt.Sprintf("#!/bin/bash\nmkdir -p %s/%s/$1\nmv $2 $3 %s/%s/$1\n", pwd, tmpDir, pwd, tmpDir) } - if err := ioutil.WriteFile(scriptFile, []byte(content), 0777); err != nil { + if err := os.WriteFile(scriptFile, []byte(content), 0777); err != nil { t.Fatalf("Error creating script: %v", err) } defer os.Remove(scriptFile) @@ -857,7 +856,7 @@ func TestFSArchiveScript(t *testing.T) { // Create a script that will error out os.Remove(scriptFile) content = "xxx" - if err := ioutil.WriteFile(scriptFile, []byte(content), 0777); err != nil { + if err := os.WriteFile(scriptFile, []byte(content), 0777); err != nil { t.Fatalf("Error creating script: %v", err) } defer os.Remove(scriptFile) @@ -1347,7 +1346,7 @@ func TestFSPanicOnMsgExpireWithClosedDatFile(t *testing.T) { ms.Lock() idxFileName := ms.files[1].idxFile.name os.Remove(idxFileName) - err := ioutil.WriteFile(idxFileName, []byte("xxxxxxx"), 0666) + err := os.WriteFile(idxFileName, []byte("xxxxxxx"), 0666) ms.Unlock() if err != nil { t.Fatalf("Error rewriting index file: %v", err) @@ -1698,11 +1697,11 @@ func TestFSExpirationWithTruncatedNonLastSlice(t *testing.T) { s.Close() - datContent, err := ioutil.ReadFile(fname) + datContent, err := os.ReadFile(fname) if err != nil { t.Fatalf("Error reading %v: %v", fname, err) } - if err := ioutil.WriteFile(fname, datContent[:len(datContent)-5], 0666); err != nil { + if err := os.WriteFile(fname, datContent[:len(datContent)-5], 0666); err != nil { t.Fatalf("Error writing file %v: %v", fname, err) } @@ -1929,12 +1928,12 @@ func TestFSNoPanicOnRemoveMsg(t *testing.T) { ms.Lock() idxFile := ms.files[1].idxFile ms.fm.closeLockedOrOpenedFile(idxFile) - content, err := ioutil.ReadFile(idxFile.name) + content, err := os.ReadFile(idxFile.name) if err != nil { t.Fatalf("Error reading file: %v", err) } copy(content[4:], []byte("xxx")) - if err := ioutil.WriteFile(idxFile.name, content, 0600); err != nil { + if err := os.WriteFile(idxFile.name, content, 0600); err != nil { t.Fatalf("Error writing file: %v", err) } ms.Unlock() @@ -2331,12 +2330,12 @@ func TestFSExpirationError(t *testing.T) { ms.Lock() idxFile := ms.files[1].idxFile ms.fm.closeLockedOrOpenedFile(idxFile) - content, err := ioutil.ReadFile(idxFile.name) + content, err := os.ReadFile(idxFile.name) if err != nil { t.Fatalf("Error reading file: %v", err) } copy(content[4:], []byte("xxx")) - if err := ioutil.WriteFile(idxFile.name, content, 0600); err != nil { + if err := os.WriteFile(idxFile.name, content, 0600); err != nil { t.Fatalf("Error writing file: %v", err) } ms.Unlock() @@ -2385,7 +2384,7 @@ func TestFSMsgsFileVersionError(t *testing.T) { s.Close() os.Remove(fname) - if err := ioutil.WriteFile(fname, []byte(""), 0666); err != nil { + if err := os.WriteFile(fname, []byte(""), 0666); err != nil { t.Fatalf("Error writing file: %v", err) } diff --git a/stores/filestore_sub_test.go b/stores/filestore_sub_test.go index 44fe5154..08babba6 100644 --- a/stores/filestore_sub_test.go +++ b/stores/filestore_sub_test.go @@ -15,7 +15,6 @@ package stores import ( "hash/crc32" - "io/ioutil" "os" "path/filepath" "reflect" @@ -911,7 +910,7 @@ func TestFSSubscriptionsFileVersionError(t *testing.T) { s.Close() os.Remove(fname) - if err := ioutil.WriteFile(fname, []byte(""), 0666); err != nil { + if err := os.WriteFile(fname, []byte(""), 0666); err != nil { t.Fatalf("Error writing file: %v", err) } diff --git a/stores/filestore_test.go b/stores/filestore_test.go index 3a4ba01a..7fc2f2c8 100644 --- a/stores/filestore_test.go +++ b/stores/filestore_test.go @@ -18,7 +18,6 @@ import ( "fmt" "hash/crc32" "io" - "io/ioutil" "math/rand" "os" "path" @@ -46,7 +45,7 @@ var ( var testFDsLimit = int64(5) func init() { - tmpDir, err := ioutil.TempDir(".", "data_stores_") + tmpDir, err := os.MkdirTemp(".", "data_stores_") if err != nil { panic("Could not create tmp dir") } @@ -1774,8 +1773,8 @@ func TestFSParallelRecovery(t *testing.T) { numRoutines := runtime.NumGoroutine() // Make several channels fail to recover fname := fmt.Sprintf("%s.1.%s", msgFilesPrefix, datSuffix) - ioutil.WriteFile(filepath.Join(testFSDefaultDatastore, "foo.50", fname), []byte("dummy"), 0666) - ioutil.WriteFile(filepath.Join(testFSDefaultDatastore, "foo.51", fname), []byte("dummy"), 0666) + os.WriteFile(filepath.Join(testFSDefaultDatastore, "foo.50", fname), []byte("dummy"), 0666) + os.WriteFile(filepath.Join(testFSDefaultDatastore, "foo.51", fname), []byte("dummy"), 0666) s, err := NewFileStore(testLogger, testFSDefaultDatastore, &testDefaultStoreLimits, ParallelRecovery(10)) if err == nil { _, err = s.Recover() @@ -2089,7 +2088,7 @@ func TestFSServerAndClientFilesVersionError(t *testing.T) { s.Close() os.Remove(fname) - if err := ioutil.WriteFile(fname, []byte(""), 0666); err != nil { + if err := os.WriteFile(fname, []byte(""), 0666); err != nil { t.Fatalf("Error creating file: %v", err) } diff --git a/stores/raftstore_test.go b/stores/raftstore_test.go index 5d1be27e..2a1c6cfb 100644 --- a/stores/raftstore_test.go +++ b/stores/raftstore_test.go @@ -15,7 +15,6 @@ package stores import ( "fmt" - "io/ioutil" "os" "reflect" "testing" @@ -27,7 +26,7 @@ import ( var testRSDefaultDatastore string func init() { - tmpDir, err := ioutil.TempDir(".", "raft_data_stores_") + tmpDir, err := os.MkdirTemp(".", "raft_data_stores_") if err != nil { panic("Could not create tmp dir") } diff --git a/stores/store.go b/stores/store.go index 1c8ee231..4d02b46a 100644 --- a/stores/store.go +++ b/stores/store.go @@ -143,7 +143,6 @@ type Channel struct { // If an implementation has a Store constructor with StoreLimits, it should be // noted that the limits don't apply to any state being recovered, for Store // implementations supporting recovery. -// type Store interface { // GetExclusiveLock is an advisory lock to prevent concurrent // access to the store from multiple instances.