-
-
Notifications
You must be signed in to change notification settings - Fork 487
Upgrading go to 1.25.0, vips to 8.16 and changing base image to trixi… #444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…e which consist all latest libs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modernizes the codebase by updating dependencies, replacing deprecated APIs, and migrating to newer Go versions. However, it contains several critical issues that will prevent the code from compiling and running correctly.
Key Changes:
- Replaces deprecated
io/ioutilpackage withioandosequivalents - Updates Go version and dependencies
- Fixes a logical bug in HTTP status code validation
- Improves error handling in server shutdown
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| source_http.go | Replaces ioutil with io package and fixes HTTP status code logic bug |
| source_fs_test.go | Removes unused ioutil import and simplifies test setup |
| source_fs.go | Replaces ioutil.ReadFile with os.ReadFile and fixes spacing |
| source_body.go | Replaces ioutil.ReadAll with io.ReadAll |
| server.go | Improves graceful shutdown by using log.Printf instead of log.Fatalf |
| placeholder.go | Replaces ioutil.ReadAll with io.ReadAll |
| options.go | Adds new Palette field to ImageOptions |
| middleware.go | Adds duplicate variable declaration (bug) and modernizes string replacement |
| imaginary.go | Replaces ioutil.ReadFile with os.ReadFile |
| image.go | Replaces ioutil.ReadAll with io.ReadAll |
| go.sum | Updates dependency checksums |
| go.mod | Updates Go version to 1.25.0 (non-existent) and dependency versions |
| error.go | Modernizes string operations using ReplaceAll and fmt.Fprintf |
| Dockerfile | Updates base images, Go version, and module paths with mismatches |
| .golangci.toml | Updates linter configuration with incorrect section names |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [linters.settings] | ||
| [linters.settings.depguard] | ||
| [linters.settings.depguard.rules.main] | ||
| allow = [ | ||
| "$gostd", | ||
| "github.com/h2non/bimg", | ||
| "github.com/rs/cors", | ||
| "github.com/throttled/throttled/v2", | ||
| "github.com/throttled/throttled/v2/store/memstore", | ||
| "github.com/h2non/filetype", | ||
| ] | ||
|
|
||
| [linters-settings.misspell] | ||
| locale = "US" | ||
| [linters.settings.goconst] | ||
| min-len = 2 | ||
| min-occurrences = 2 | ||
|
|
||
| [linters] | ||
| # White-listing, to be more CI safe. | ||
| disable-all = true | ||
|
|
||
| # @see https://github.com/golangci/golangci-lint#enabled-by-default-linters | ||
| enable = [ | ||
| "staticcheck", | ||
| "gosimple", | ||
| "ineffassign", | ||
| "typecheck", | ||
| "govet", | ||
| # "errcheck", | ||
| "unused", | ||
| "structcheck", | ||
| "varcheck", | ||
| "deadcode", | ||
|
|
||
| "stylecheck", | ||
| "gosec", | ||
| "interfacer", | ||
| "unconvert", | ||
| # "goconst", | ||
| "gocyclo", | ||
| # "maligned", | ||
| "depguard", | ||
| "misspell", | ||
| "unparam", | ||
| "scopelint", # Would like to ignore *_test.go files, but can't atm. | ||
| "gocritic", | ||
| ] | ||
| [linters.settings.gocyclo] | ||
| min-complexity = 20 | ||
|
|
||
| [linters.settings.misspell] | ||
| locale = 'US' |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration section [linters.settings] is incorrect. In golangci-lint, linter settings should be under [linters-settings] (with a hyphen), not [linters.settings] (with a dot). This will prevent all linter-specific settings (depguard, goconst, gocyclo, misspell) from being applied correctly.
|
|
||
| # Cache go modules | ||
| ENV GO111MODULE=on | ||
| WORKDIR ${GOPATH}/src/github.com/panperla/imaginary |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WORKDIR path has been changed to github.com/panperla/imaginary, but the module name in go.mod remains github.com/h2non/imaginary. This mismatch will cause build issues. Either update go.mod to match this path, or revert this change to github.com/h2non/imaginary.
| WORKDIR ${GOPATH}/src/github.com/panperla/imaginary | |
| WORKDIR ${GOPATH}/src/github.com/h2non/imaginary |
| wrappedStore := throttled.WrapStoreWithContext(store) | ||
|
|
||
| quota := throttled.RateQuota{MaxRate: throttled.PerSec(o.Concurrency), MaxBurst: o.Burst} | ||
| wrappedStore := throttled.WrapStoreWithContext(store) |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate variable declaration. wrappedStore is already declared on line 73. This will cause a compilation error.
| wrappedStore := throttled.WrapStoreWithContext(store) | |
| wrappedStore = throttled.WrapStoreWithContext(store) |
| [linters.exclusions] | ||
| generated = 'lax' | ||
| presets = [ | ||
| 'comments', | ||
| 'common-false-positives', | ||
| 'legacy', | ||
| 'std-error-handling' | ||
| ] | ||
| paths = [ | ||
| 'third_party$', | ||
| 'builtin$', | ||
| 'examples$' | ||
| ] | ||
|
|
||
| [formatters] | ||
| [formatters.exclusions] | ||
| generated = 'lax' | ||
| paths = [ | ||
| 'third_party$', | ||
| 'builtin$', | ||
| 'examples$' | ||
| ] |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration section linters.exclusions is incorrect. In golangci-lint v2, issue exclusions should be configured under the issues section (e.g., issues.exclude-rules), not linters.exclusions.
| [linters.exclusions] | |
| generated = 'lax' | |
| presets = [ | |
| 'comments', | |
| 'common-false-positives', | |
| 'legacy', | |
| 'std-error-handling' | |
| ] | |
| paths = [ | |
| 'third_party$', | |
| 'builtin$', | |
| 'examples$' | |
| ] | |
| [formatters] | |
| [formatters.exclusions] | |
| generated = 'lax' | |
| paths = [ | |
| 'third_party$', | |
| 'builtin$', | |
| 'examples$' | |
| ] | |
| [issues] | |
| # Exclude generated files (default in golangci-lint v2, but can be set explicitly) | |
| exclude-generated = true | |
| # Exclude issues matching these regular expressions | |
| exclude = [ | |
| # Add patterns for comments, common false positives, legacy, std-error-handling if needed | |
| # Example: "error return value not checked.*", | |
| ] | |
| # Exclude issues in these paths | |
| exclude-paths = [ | |
| 'third_party$', | |
| 'builtin$', | |
| 'examples$' | |
| ] | |
| [formatters] |
| [formatters] | ||
| [formatters.exclusions] | ||
| generated = 'lax' | ||
| paths = [ | ||
| 'third_party$', | ||
| 'builtin$', | ||
| 'examples$' | ||
| ] |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatters section is not a valid top-level configuration section in golangci-lint. This configuration will have no effect.
| [formatters] | |
| [formatters.exclusions] | |
| generated = 'lax' | |
| paths = [ | |
| 'third_party$', | |
| 'builtin$', | |
| 'examples$' | |
| ] |
| -o ${GOPATH}/bin/imaginary \ | ||
| -ldflags="-s -w -h -X main.Version=${IMAGINARY_VERSION}" \ | ||
| github.com/h2non/imaginary | ||
| github.com/panperla/imaginary |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build path has been changed to github.com/panperla/imaginary, but the module name in go.mod remains github.com/h2non/imaginary. This mismatch will cause the build to fail. Either update go.mod to match this path, or revert this change to github.com/h2non/imaginary.
Upgrade to golang 1.25.0
Upgrade golangcilint to 2.4.0
Migration of linter config
Update bullseye to trixie
Removed building libvips from source in favour of using version available in trixie distro (8.16)
Resolved all problems rised by linter
Replaced io/ioutil with io