[PR #1328] [MERGED] GO: Modernize Go modules by removing deprecated ioutil usage and adding proper version requirements. #1918

Open
opened 2026-01-29 20:56:27 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/1328
Author: @akazwz
Created: 9/12/2025
Status: Merged
Merged: 10/6/2025
Merged by: @copybara-service[bot]

Base: masterHead: go


📝 Commits (3)

  • 3d8eef2 Update Go modules to require Go 1.21 and replace ioutil with io package in reader.go
  • 2c5f2d1 Merge branch 'master' into go
  • e4e56a3 Add missing newline

📊 Changes

3 files changed (+5 additions, -2 deletions)

View changed files

📝 go/brotli/go.mod (+2 -0)
📝 go/brotli/reader.go (+1 -2)
📝 go/cbrotli/go.mod (+2 -0)

📄 Description

Summary

This PR modernizes the Go code by removing deprecated ioutil package usage and adding proper Go version requirements to the module files.

Changes

1. Remove deprecated ioutil package usage

  • Remove "io/ioutil" import from go/brotli/reader.go
  • Replace ioutil.ReadAll() with io.ReadAll()

The ioutil package has been deprecated since Go 1.16, with its functions moved to io and os packages for better organization.

2. Add Go version requirements

  • Add go 1.21 to both go/brotli/go.mod and go/cbrotli/go.mod

This is necessary because:

  • The code uses the min() builtin function introduced in Go 1.21
  • io.ReadAll() requires Go 1.16+
  • Go 1.21 is the minimum version that supports all features used in the codebase

Benefits

  • Removes deprecated API usage
  • Uses modern Go standard library APIs
  • Properly declares minimum Go version requirements
  • Improves future maintainability
  • Follows Go community best practices

Testing

  • Code compiles successfully with Go 1.21+
  • No behavioral changes - purely modernization updates
  • Existing functionality remains unchanged

Compatibility

  • Minimum Go version: Now requires Go 1.21+ (previously undefined)
  • No breaking changes: All existing APIs remain the same
  • Backward compatible: Existing users can upgrade seamlessly if using Go 1.21+

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/1328 **Author:** [@akazwz](https://github.com/akazwz) **Created:** 9/12/2025 **Status:** ✅ Merged **Merged:** 10/6/2025 **Merged by:** [@copybara-service[bot]](https://github.com/apps/copybara-service) **Base:** `master` ← **Head:** `go` --- ### 📝 Commits (3) - [`3d8eef2`](https://github.com/google/brotli/commit/3d8eef20a6b147b2eff8ced4b358680a89399097) Update Go modules to require Go 1.21 and replace ioutil with io package in reader.go - [`2c5f2d1`](https://github.com/google/brotli/commit/2c5f2d1198806b164b56cf97f6f8ec1fd6b9cc0a) Merge branch 'master' into go - [`e4e56a3`](https://github.com/google/brotli/commit/e4e56a320302397399728344e043e2234439f251) Add missing newline ### 📊 Changes **3 files changed** (+5 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `go/brotli/go.mod` (+2 -0) 📝 `go/brotli/reader.go` (+1 -2) 📝 `go/cbrotli/go.mod` (+2 -0) </details> ### 📄 Description ## Summary This PR modernizes the Go code by removing deprecated `ioutil` package usage and adding proper Go version requirements to the module files. ## Changes ### 1. Remove deprecated `ioutil` package usage - Remove `"io/ioutil"` import from `go/brotli/reader.go` - Replace `ioutil.ReadAll()` with `io.ReadAll()` The `ioutil` package has been deprecated since Go 1.16, with its functions moved to `io` and `os` packages for better organization. ### 2. Add Go version requirements - Add `go 1.21` to both `go/brotli/go.mod` and `go/cbrotli/go.mod` This is necessary because: - The code uses the `min()` builtin function introduced in Go 1.21 - `io.ReadAll()` requires Go 1.16+ - Go 1.21 is the minimum version that supports all features used in the codebase ## Benefits - ✅ Removes deprecated API usage - ✅ Uses modern Go standard library APIs - ✅ Properly declares minimum Go version requirements - ✅ Improves future maintainability - ✅ Follows Go community best practices ## Testing - [x] Code compiles successfully with Go 1.21+ - [x] No behavioral changes - purely modernization updates - [x] Existing functionality remains unchanged ## Compatibility - **Minimum Go version**: Now requires Go 1.21+ (previously undefined) - **No breaking changes**: All existing APIs remain the same - **Backward compatible**: Existing users can upgrade seamlessly if using Go 1.21+ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:56:27 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#1918