Skip to content

Add support for transparent gzip handling#14

Merged
Jguer merged 7 commits into
mainfrom
jguer/update-build
Dec 20, 2025
Merged

Add support for transparent gzip handling#14
Jguer merged 7 commits into
mainfrom
jguer/update-build

Conversation

@Jguer

@Jguer Jguer commented Dec 20, 2025

Copy link
Copy Markdown
Owner

No description provided.

@Jguer Jguer self-assigned this Dec 20, 2025
Copilot AI review requested due to automatic review settings December 20, 2025 19:03
@Jguer Jguer merged commit d88e62e into main Dec 20, 2025
2 checks passed
@Jguer Jguer deleted the jguer/update-build branch December 20, 2025 19:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds transparent gzip handling for downloading AUR metadata, allowing the code to automatically detect and decompress gzip-compressed responses. The PR also updates Go from version 1.19 to 1.25, modernizes dependencies, updates GitHub Actions, restructures the golangci-lint configuration, and adds devcontainer support.

  • Implements transparent gzip decompression in metadata downloads with magic number detection
  • Updates dependencies including testing libraries (testify 1.8.1 → 1.11.1), gojq, and ojg
  • Modernizes GitHub Actions workflow (checkout@v2 → v6, setup-go@v2 → v6, golangci-lint-action@v2 → v9)

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
metadata/cache.go Adds newGzipResponseReader function with gzip magic number detection and two wrapper types (gzipReader, bufferedReader) to handle both compressed and uncompressed responses
metadata/integration_test.go Adds integration test for real AUR metadata download with gzip decompression
rpc/req.go Refactors empty string check from len(result.Error) > 0 to more idiomatic result.Error != ""
rpc/query.go Removes custom min function and renames variable max to maxIdx for clarity (relies on builtin min from Go 1.21+)
go.mod Updates Go version to 1.25 and upgrades dependencies
go.sum Updates checksums for new dependency versions
.golangci.yml Restructures configuration to version 2 format with new settings organization
.github/workflows/go.yml Updates GitHub Actions versions and Go version, reduces test matrix to ubuntu-latest only
.devcontainer/devcontainer.json Adds VS Code devcontainer configuration
.devcontainer/Dockerfile Adds devcontainer Dockerfile based on jguer/yay-builder image

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread metadata/cache.go
Comment on lines +186 to +188

func (z *gzipReader) Close() error {
z.Reader.Close()

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

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

The Close method should handle errors from both closers. Currently, if Reader.Close() returns an error, it's ignored and only body.Close() error is returned. Consider using a multierror approach or at least log the first error.

Copilot uses AI. Check for mistakes.
Comment thread metadata/cache.go
Comment on lines +165 to +179

func newGzipResponseReader(body io.ReadCloser) (io.ReadCloser, error) {
br := bufio.NewReader(body)

// gzip magic number: 0x1f, 0x8b
if head, err := br.Peek(2); err == nil && len(head) == 2 && head[0] == 0x1f && head[1] == 0x8b {
gz, err := gzip.NewReader(br)
if err != nil {
body.Close()
return nil, fmt.Errorf("failed to create gzip reader: %w", err)
}
return &gzipReader{Reader: gz, body: body}, nil
}

return &bufferedReader{Reader: br, body: body}, nil

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

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

The new gzip handling functionality lacks unit test coverage. Consider adding tests for both gzip-compressed and uncompressed responses to verify the transparent decompression works correctly, and to test error cases such as invalid gzip data.

Copilot uses AI. Check for mistakes.
Comment thread .golangci.yml

version: "2"
run:
go: "1.18"

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

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

The Go version specified here (1.18) is inconsistent with the go.mod file which specifies 1.25. These should be aligned to ensure consistent linting behavior.

Suggested change
go: "1.18"
go: "1.25"

Copilot uses AI. Check for mistakes.
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