Skip to content

Replace deprecated io/ioutil with modern os/io equivalents#373

Merged
tnikolova82 merged 1 commit into
masterfrom
fix/remove-ioutil-deprecations
Mar 6, 2026
Merged

Replace deprecated io/ioutil with modern os/io equivalents#373
tnikolova82 merged 1 commit into
masterfrom
fix/remove-ioutil-deprecations

Conversation

@ramonskie

Copy link
Copy Markdown
Contributor

Summary

  • Replaces all ioutil.ReadFile, WriteFile, ReadDir, TempDir, TempFile, ReadAll, and Discard calls with their Go 1.16+ equivalents in the os and io packages
  • Removes deprecated rand.Seed(time.Now().UnixNano()) from randomString() (deprecated since Go 1.20; math/rand is kept since rand.Intn is still used)
  • Removes the now-unused "time" import from supply.go

Motivation

io/ioutil was deprecated in Go 1.16 and rand.Seed was deprecated in Go 1.20. All buildpacks now target Go 1.24.x.

Related

Part of a series of identical PRs across all CF buildpacks and libbuildpack (see cloudfoundry/libbuildpack#211).

Replaces all ioutil.ReadFile, WriteFile, ReadDir, TempDir, TempFile,
ReadAll and Discard calls with their Go 1.16+ replacements in os and io
packages. Also removes deprecated rand.Seed(time.Now().UnixNano()) from
randomString() (deprecated since Go 1.20) and removes the now-unused
time import.
@ramonskie ramonskie force-pushed the fix/remove-ioutil-deprecations branch from 5880634 to 09e6d0c Compare March 3, 2026 10:28

@tnikolova82 tnikolova82 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tnikolova82 tnikolova82 merged commit f75915b into master Mar 6, 2026
7 checks passed
@tnikolova82 tnikolova82 deleted the fix/remove-ioutil-deprecations branch March 6, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants