Build Fixes & Optimisations #16
Merged
aryanmehrotra merged 14 commits intozopdev:mainfrom Feb 25, 2026
Merged
Conversation
- Bump Go version to 1.26 in workflow and Dockerfile - Update golangci-lint to v2.10.1 and migrate config to v2 format - Update docker/login-action to v3 - Make Docker push configurable via DOCKER_USERNAME, DOCKER_PASSWORD, and DOCKER_REGISTRY_TARGET variables - Add validation step to fail fast if Docker config is missing - Push both version tag and latest tag on release - Fix errcheck issues in tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add sanitizePath function to validate paths stay within static directory - Extract resolveFilePath function to reduce cyclomatic complexity - Prevents directory traversal attacks via malicious URL paths Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- TestSanitizePath: verifies path normalization behavior - TestSanitizePathPreventsEscape: verifies all paths stay within static dir Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- G703 (path traversal) in main.go: paths are sanitized via sanitizePath - G704 (SSRF) in tests: test code intentionally makes HTTP requests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Go's net/http server already handles path traversal by returning 307 redirects for paths containing '..', normalizing them before they reach the handler. The original code using filepath.Join was already safe. Keeping gosec exclusions in .golangci.yml for the false positives. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of failing the workflow when Docker credentials are not configured, emit warnings and skip the Docker login/push steps. This allows the release job to complete successfully even without Docker Hub configuration. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Go module caching via actions/setup-go cache: true - Replace container-based golangci-lint with golangci-lint-action@v6 (eliminates container pull, adds lint caching) - Add Docker layer caching via buildx and GitHub Actions cache - Skip all release steps if Docker config is missing (not just push) - Remove redundant go mod download steps Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- New check_docker_config job outputs whether Docker is configured - release_package job skipped cleanly if config missing (via job-level if) - Cleaner workflow visualization - job shows as "skipped" instead of running with all steps skipped Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use gcr.io/distroless/static-debian12 for minimal attack surface - Build with CGO_ENABLED=0 for static binary - Add -s -w ldflags to strip debug info and reduce size - Remove Alpine and apk dependencies Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated README.md with tag v0.0.6 instead of latest
Contributor
Author
|
@aryanmehrotra I've updated the workflow to remove the |
There was a problem hiding this comment.
Pull request overview
This pull request aims to update dependencies, modernize the build pipeline, and optimize the Docker image. The changes include upgrading the gofr.dev framework version, updating GitHub Actions workflows, switching to a distroless Docker base image, and modernizing the golangci-lint configuration.
Changes:
- Updated gofr.dev from v1.34.0 to v1.54.3 to resolve HTTP response writer warnings
- Modernized GitHub Actions workflow with improved version management, Docker configuration validation, and build caching
- Switched to distroless base image for reduced image size and improved security with nonroot user
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| main_test.go | Improved error handling by explicitly handling Close() and RemoveAll() return values |
| go.mod | Updated Go version and gofr.dev dependency with numerous transitive dependency updates |
| go.sum | Checksums for updated dependencies |
| Dockerfile | Switched to distroless image, optimized build process with layer caching, added nonroot user for security |
| README.md | Updated Docker image tag reference from latest to v0.0.6 |
| .golangci.yml | Modernized configuration to version 2 format with restructured linter settings |
| .github/workflows/go.yaml | Enhanced workflow with Docker config validation, updated action versions, improved caching |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aryanmehrotra
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
http: superfluous response.WriteHeader call from gofr.dev/pkg/gofr/http/middleware.(*StatusResponseWriter).WriteHeader (logger.go:23)Need to set the below in Github Vars: