@@ -3,7 +3,7 @@ package resource_test
33import (
44 "bytes"
55 "errors"
6- "io/ioutil "
6+ "io"
77 "net/http"
88 "net/url"
99 "os"
@@ -40,14 +40,14 @@ var _ = Describe("In Command", func() {
4040
4141 githubClient = & fakes.FakeGitHub {}
4242 githubServer = ghttp .NewServer ()
43- command = resource .NewInCommand (githubClient , ioutil .Discard )
43+ command = resource .NewInCommand (githubClient , io .Discard )
4444
45- tmpDir , err = ioutil . TempDir ("" , "github-release" )
45+ tmpDir , err = os . MkdirTemp ("" , "github-release" )
4646 Ω (err ).ShouldNot (HaveOccurred ())
4747
4848 destDir = filepath .Join (tmpDir , "destination" )
4949
50- githubClient .DownloadReleaseAssetReturns (ioutil .NopCloser (bytes .NewBufferString ("some-content" )), nil )
50+ githubClient .DownloadReleaseAssetReturns (io .NopCloser (bytes .NewBufferString ("some-content" )), nil )
5151
5252 inRequest = resource.InRequest {}
5353 })
@@ -167,27 +167,27 @@ var _ = Describe("In Command", func() {
167167 It ("does create the body, tag, version, and url files" , func () {
168168 inResponse , inErr = command .Run (destDir , inRequest )
169169
170- contents , err := ioutil .ReadFile (path .Join (destDir , "tag" ))
170+ contents , err := os .ReadFile (path .Join (destDir , "tag" ))
171171 Ω (err ).ShouldNot (HaveOccurred ())
172172 Ω (string (contents )).Should (Equal ("v0.35.0" ))
173173
174- contents , err = ioutil .ReadFile (path .Join (destDir , "version" ))
174+ contents , err = os .ReadFile (path .Join (destDir , "version" ))
175175 Ω (err ).ShouldNot (HaveOccurred ())
176176 Ω (string (contents )).Should (Equal ("0.35.0" ))
177177
178- contents , err = ioutil .ReadFile (path .Join (destDir , "commit_sha" ))
178+ contents , err = os .ReadFile (path .Join (destDir , "commit_sha" ))
179179 Ω (err ).ShouldNot (HaveOccurred ())
180180 Ω (string (contents )).Should (Equal ("f28085a4a8f744da83411f5e09fd7b1709149eee" ))
181181
182- contents , err = ioutil .ReadFile (path .Join (destDir , "body" ))
182+ contents , err = os .ReadFile (path .Join (destDir , "body" ))
183183 Ω (err ).ShouldNot (HaveOccurred ())
184184 Ω (string (contents )).Should (Equal ("*markdown*" ))
185185
186- contents , err = ioutil .ReadFile (path .Join (destDir , "timestamp" ))
186+ contents , err = os .ReadFile (path .Join (destDir , "timestamp" ))
187187 Ω (err ).ShouldNot (HaveOccurred ())
188188 Ω (string (contents )).Should (Equal ("2018-01-01T00:00:00Z" ))
189189
190- contents , err = ioutil .ReadFile (path .Join (destDir , "url" ))
190+ contents , err = os .ReadFile (path .Join (destDir , "url" ))
191191 Ω (err ).ShouldNot (HaveOccurred ())
192192 Ω (string (contents )).Should (Equal ("http://google.com" ))
193193 })
@@ -211,15 +211,15 @@ var _ = Describe("In Command", func() {
211211 It ("does create the tag, version, and url files" , func () {
212212 inResponse , inErr = command .Run (destDir , inRequest )
213213
214- contents , err := ioutil .ReadFile (path .Join (destDir , "tag" ))
214+ contents , err := os .ReadFile (path .Join (destDir , "tag" ))
215215 Ω (err ).ShouldNot (HaveOccurred ())
216216 Ω (string (contents )).Should (Equal ("package-0.35.0" ))
217217
218- contents , err = ioutil .ReadFile (path .Join (destDir , "version" ))
218+ contents , err = os .ReadFile (path .Join (destDir , "version" ))
219219 Ω (err ).ShouldNot (HaveOccurred ())
220220 Ω (string (contents )).Should (Equal ("0.35.0" ))
221221
222- contents , err = ioutil .ReadFile (path .Join (destDir , "url" ))
222+ contents , err = os .ReadFile (path .Join (destDir , "url" ))
223223 Ω (err ).ShouldNot (HaveOccurred ())
224224 Ω (string (contents )).Should (Equal ("http://google.com" ))
225225 })
@@ -265,7 +265,7 @@ var _ = Describe("In Command", func() {
265265 It ("saves the source tarball in the destination directory" , func () {
266266 inResponse , inErr = command .Run (destDir , inRequest )
267267
268- fileContents , err := ioutil .ReadFile (filepath .Join (destDir , "source.tar.gz" ))
268+ fileContents , err := os .ReadFile (filepath .Join (destDir , "source.tar.gz" ))
269269 fContents := string (fileContents )
270270 Expect (err ).NotTo (HaveOccurred ())
271271 Expect (fContents ).To (Equal ("source-tar-file-contents" ))
@@ -275,7 +275,7 @@ var _ = Describe("In Command", func() {
275275 inRequest .Source .AssetDir = true
276276 inResponse , inErr = command .Run (destDir , inRequest )
277277
278- fileContents , err := ioutil .ReadFile (filepath .Join (destDir , "assets" , "source.tar.gz" ))
278+ fileContents , err := os .ReadFile (filepath .Join (destDir , "assets" , "source.tar.gz" ))
279279 fContents := string (fileContents )
280280 Expect (err ).NotTo (HaveOccurred ())
281281 Expect (fContents ).To (Equal ("source-tar-file-contents" ))
@@ -355,7 +355,7 @@ var _ = Describe("In Command", func() {
355355 It ("saves the source zip in the destination directory" , func () {
356356 inResponse , inErr = command .Run (destDir , inRequest )
357357
358- fileContents , err := ioutil .ReadFile (filepath .Join (destDir , "source.zip" ))
358+ fileContents , err := os .ReadFile (filepath .Join (destDir , "source.zip" ))
359359 fContents := string (fileContents )
360360 Expect (err ).NotTo (HaveOccurred ())
361361 Expect (fContents ).To (Equal ("source-zip-file-contents" ))
@@ -365,7 +365,7 @@ var _ = Describe("In Command", func() {
365365 inRequest .Source .AssetDir = true
366366 inResponse , inErr = command .Run (destDir , inRequest )
367367
368- fileContents , err := ioutil .ReadFile (filepath .Join (destDir , "assets" , "source.zip" ))
368+ fileContents , err := os .ReadFile (filepath .Join (destDir , "assets" , "source.zip" ))
369369 fContents := string (fileContents )
370370 Expect (err ).NotTo (HaveOccurred ())
371371 Expect (fContents ).To (Equal ("source-zip-file-contents" ))
@@ -525,15 +525,15 @@ var _ = Describe("In Command", func() {
525525 })
526526
527527 It ("does create the tag, version, and URL files" , func () {
528- contents , err := ioutil .ReadFile (path .Join (destDir , "tag" ))
528+ contents , err := os .ReadFile (path .Join (destDir , "tag" ))
529529 Ω (err ).ShouldNot (HaveOccurred ())
530530 Ω (string (contents )).Should (Equal ("v0.35.0" ))
531531
532- contents , err = ioutil .ReadFile (path .Join (destDir , "version" ))
532+ contents , err = os .ReadFile (path .Join (destDir , "version" ))
533533 Ω (err ).ShouldNot (HaveOccurred ())
534534 Ω (string (contents )).Should (Equal ("0.35.0" ))
535535
536- contents , err = ioutil .ReadFile (path .Join (destDir , "url" ))
536+ contents , err = os .ReadFile (path .Join (destDir , "url" ))
537537 Ω (err ).ShouldNot (HaveOccurred ())
538538 Ω (string (contents )).Should (Equal ("http://google.com" ))
539539 })
@@ -572,7 +572,7 @@ var _ = Describe("In Command", func() {
572572 })
573573
574574 It ("does create the url file" , func () {
575- contents , err := ioutil .ReadFile (path .Join (destDir , "url" ))
575+ contents , err := os .ReadFile (path .Join (destDir , "url" ))
576576 Ω (err ).ShouldNot (HaveOccurred ())
577577 Ω (string (contents )).Should (Equal ("http://google.com" ))
578578 })
@@ -610,7 +610,7 @@ var _ = Describe("In Command", func() {
610610 })
611611
612612 It ("does create the url file" , func () {
613- contents , err := ioutil .ReadFile (path .Join (destDir , "url" ))
613+ contents , err := os .ReadFile (path .Join (destDir , "url" ))
614614 Ω (err ).ShouldNot (HaveOccurred ())
615615 Ω (string (contents )).Should (Equal ("http://google.com" ))
616616 })
0 commit comments