upgrade go, public submodule & golangci-lint#159
Conversation
📝 WalkthroughWalkthroughUpdates linter configuration to golangci-lint v2 and lint/build images, bumps Go toolchain and module versions to 1.26.3, and applies minor error-message, reflect-kind, logging, and CI YAML formatting tweaks. ChangesLinter Configuration and Build Infrastructure Upgrade
Go Toolchain and Dependency Modernization
Error Handling and Code Quality Refinements
CI Workflow updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.golangci.yml (1)
1-39:⚠️ Potential issue | 🟠 MajorFix golangci-lint v2 config schema mismatches in
.golangci.yml
.linters.exclusions.presetslikely uses invalid preset identifiers (common-false-positives,std-error-handling); v2 expects the correct names (e.g.,commonFalsePositives,stdErrorHandling), otherwise exclusions may be ignored.- The
govetblock likely has an invalid key placement for bulk enabling (linters.settings.govet.enable-all: true); v2 expects govet analyzer selection via the supportedlinters.settings.govetfields (usegolangci-lint migrateagainst the v2 schema to avoid key/path mismatches).- The Docker digest check for
golangci/golangci-lint:v2.12.2can’t be run in the current environment (nodockerbinary); validate it in CI/local.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.golangci.yml around lines 1 - 39, Update the .golangci.yml to match golangci-lint v2 schema: rename the presets under linters.exclusions.presets from dashed names to camelCase (e.g., common-false-positives -> commonFalsePositives, std-error-handling -> stdErrorHandling), and remove or replace the unsupported govet key linters.settings.govet.enable-all: true by configuring govet according to v2 schema (use supported fields under linters.settings.govet or run `golangci-lint migrate` to generate the correct govet analyzer settings); validate the final config locally/CI rather than relying on a Docker digest check in this environment.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.golangci.yml:
- Around line 1-39: Update the .golangci.yml to match golangci-lint v2 schema:
rename the presets under linters.exclusions.presets from dashed names to
camelCase (e.g., common-false-positives -> commonFalsePositives,
std-error-handling -> stdErrorHandling), and remove or replace the unsupported
govet key linters.settings.govet.enable-all: true by configuring govet according
to v2 schema (use supported fields under linters.settings.govet or run
`golangci-lint migrate` to generate the correct govet analyzer settings);
validate the final config locally/CI rather than relying on a Docker digest
check in this environment.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2956012a-a443-46b9-b608-d933befd1638
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (6)
.golangci.ymlMakefilego.modserver/android_notification_server.goserver/apple_notification_server.goserver/config_push_proxy.go
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 13-15: The workflow-level permission "id-token: write" is too
broad; remove or change the top-level permissions block so it no longer grants
id-token: write globally and instead add "id-token: write" only to the specific
job(s) that require OIDC (e.g., the job names that use Chainguard identity or
OIDC), by updating the job-level permissions for those jobs to include id-token:
write while leaving workflow-level permissions as minimal (contents: read) or
omitting id-token entirely.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6cb29714-8156-408e-9f2a-46129c670914
📒 Files selected for processing (1)
.github/workflows/ci.yml
Remove overly broad workflow-level OIDC permission and add explicit job-level permissions to fips-security-scan, which was missing them.
|
Regarding the |
|
|
||
| if me.AndroidPushSettings.ServiceFileLocation == "" { | ||
| return errors.New("Android push notifications not configured. Missing ServiceFileLocation.") | ||
| return errors.New("android push notifications not configured: missing ServiceFileLocation") |
|
|
||
| errorPointer := reflect.ValueOf(err) | ||
| if errorPointer.Kind() != reflect.Ptr { | ||
| if errorPointer.Kind() != reflect.Pointer { |
There was a problem hiding this comment.
inline linting from Go 1.26+
| disable: | ||
| - fieldalignment | ||
|
|
||
| version: "2" |
| ## Docker Images | ||
| DOCKER_IMAGE_GO ?= "golang:${GO_VERSION}" | ||
| DOCKER_IMAGE_GOLINT ?= "golangci/golangci-lint:v1.64.4@sha256:e83b903d722c12402c9d88948a6cac42ea0e34bf336fc6a170ade9adeecb2d0e" | ||
| DOCKER_IMAGE_GOLINT ?= "golangci/golangci-lint:v2.12.2@sha256:91b27804074a0bacea298707f016911e60cf0cdbc6c7bf5ccacb5f0606d18d60" |
There was a problem hiding this comment.
Upgraded golangci-lint
| FIPS_ENABLED ?= false | ||
| BUILD_IMAGE_FIPS ?= cgr.dev/mattermost.com/go-msft-fips:1.24.6 | ||
| BUILD_IMAGE_FIPS ?= cgr.dev/mattermost.com/go-msft-fips:1.26.3 | ||
| BASE_IMAGE_FIPS ?= cgr.dev/mattermost.com/glibc-openssl-fips:15.1 |
There was a problem hiding this comment.
@esarafianou, this prompted me to realize we aren't bumping glibc-openssl-fips alongside the Go bumps. I can plan to do that as a separate pass and match it with the core repo, but proposing leaving it untouched for now.
Summary
In support of #158, let's bump Go, the public module, and golangci-lint. Reduce scoping of id-token to jobs that need it.
Ticket Link
Relates-to: https://mattermost.atlassian.net/browse/MM-68727