Skip to content

HMS-9066: Updating go version to 1.24#21

Merged
rverdile merged 3 commits intocontent-services:mainfrom
mayurilahane:mlahane/HMS-9066
Oct 7, 2025
Merged

HMS-9066: Updating go version to 1.24#21
rverdile merged 3 commits intocontent-services:mainfrom
mayurilahane:mlahane/HMS-9066

Conversation

@mayurilahane
Copy link
Contributor

No description provided.

Copy link
Collaborator

@rverdile rverdile left a comment

Choose a reason for hiding this comment

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

I would do a dependency bump here: go get -u ./...

@mayurilahane
Copy link
Contributor Author

Getting lint errors which suggest to use the pattern to set verison is 1.24.x

and i have set it to 1.24 which seems a better option to me

@rverdile
Copy link
Collaborator

It's a little confusing, but the linter errors are actually caused by this line here: https://github.com/content-services/tang/blob/main/.github/workflows/tang-actions.yaml#L23

It needs to be updated to a newer version of golangci-lint. I would say v2.4 to match the backend: https://github.com/content-services/content-sources-backend/blob/main/.github/workflows/content-sources-actions.yml#L51-L53

@mayurilahane
Copy link
Contributor Author

It's a little confusing, but the linter errors are actually caused by this line here: https://github.com/content-services/tang/blob/main/.github/workflows/tang-actions.yaml#L23

It needs to be updated to a newer version of golangci-lint. I would say v2.4 to match the backend: https://github.com/content-services/content-sources-backend/blob/main/.github/workflows/content-sources-actions.yml#L51-L53

how do you figure it out ? that it should match with backend golangci-lint version ?
i thought it will update by itself after go get -u cmd

@rverdile
Copy link
Collaborator

rverdile commented Sep 24, 2025

how do you figure it out ? that it should match with backend golangci-lint version ?
i thought it will update by itself after go get -u cmd

Good question. go get -u ./... will only upgrade the dependencies imported in the go.mod. golangci-lint is not a dependency, but a CLI tool for linting. We install and use it locally with make lint. so everything probably worked locally. However, the golangci-lint action is a separate github action, independent of what we use locally. We should maybe make some change to the action to match what we use locally, but just bumping the version is good for now :)

@rverdile
Copy link
Collaborator

there's a CI error. sounds like you just need to bump the action version

Failed to run: Error: invalid version string 'v2.4.0', golangci-lint v2 is not supported by golangci-lint-action v6, you must update to golangci-lint-action v7., Error: invalid version string 'v2.4.0', golangci-lint v2 is not supported by golangci-lint-action v6, you must update to golangci-lint-action v7

@mayurilahane mayurilahane force-pushed the mlahane/HMS-9066 branch 6 times, most recently from 63acd74 to ef793b0 Compare September 25, 2025 20:37
@mayurilahane
Copy link
Contributor Author

/retest

@mayurilahane mayurilahane force-pushed the mlahane/HMS-9066 branch 4 times, most recently from 0f5492c to 4127eb5 Compare September 29, 2025 05:20
…ling

- Bump Go version to 1.24 and golangci-lint to v2.4.0 in GitHub Actions workflow
- Update .golangci.yaml for compatibility with golangci-lint v2
- Refactor internal/zestwrapper/rpm.go to use safer HTTP response body closing with error handling and improved logging
- Switch to math/rand/v2 in pkg/tangy/queries.go for randomness, remove golang.org/x/exp/rand (deprecated) dependency
- Update dependancies in go.mod and go.sum
@mayurilahane mayurilahane marked this pull request as ready for review September 29, 2025 05:36
@marusak
Copy link
Member

marusak commented Sep 30, 2025

  • Bump Go version to 1.24 and golangci-lint to v2.4.0 in GitHub Actions workflow
  • Update .golangci.yaml for compatibility with golangci-lint v2
  • Refactor internal/zestwrapper/rpm.go to use safer HTTP response body closing with error handling and improved logging
  • Switch to math/rand/v2 in pkg/tangy/queries.go for randomness, remove golang.org/x/exp/rand (deprecated) dependency
  • Update dependancies in go.mod and go.sum

There seem to be ~4 different changes? But they are all in the same commit 🤔 Are they strictly connected thus being in one commit?

Comment on lines 110 to 114
defer func() {
if closeErr := httpResp.Body.Close(); closeErr != nil {
fmt.Printf("failed to close response body: %v\n", closeErr)
}
}()
Copy link
Collaborator

Choose a reason for hiding this comment

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

We prefer to ignore this linter error. Can you update the PR to use the config from the backend? That will make sure all the right linters are turned on

@rverdile
Copy link
Collaborator

rverdile commented Sep 30, 2025

There seem to be ~4 different changes? But they are all in the same commit 🤔 Are they strictly connected thus being in one commit?

@marusak They're all connected to bumping the go version and failures related to that

@mayurilahane
Copy link
Contributor Author

  • Bump Go version to 1.24 and golangci-lint to v2.4.0 in GitHub Actions workflow
  • Update .golangci.yaml for compatibility with golangci-lint v2
  • Refactor internal/zestwrapper/rpm.go to use safer HTTP response body closing with error handling and improved logging
  • Switch to math/rand/v2 in pkg/tangy/queries.go for randomness, remove golang.org/x/exp/rand (deprecated) dependency
  • Update dependancies in go.mod and go.sum

There seem to be ~4 different changes? But they are all in the same commit 🤔 Are they strictly connected thus being in one commit?

Hey yes, these are connected.
I updated go and go linter version.

Updating linter version, recomended these changes which looked good to me in pkg/tangy/queries.go and internal/zestwrapper/rpm.go.

Although i need to undo the changes in internal/zestwrapper/rpm.go as per
#21 (comment)

Update .golangci.yaml to match backend linter configuration to ensure
all appropriate linters are enabled.

- G115 - Integer overflow in pool limit:
  Change PoolLimit type from int to int32 to match pgxpool.Config.MaxConns,
  eliminating type conversion and preventing potential integer overflow.

- ST1005 - Error strings should not be capitalized
  Fix error message capitalization in zestwrapper/rpm.go
dbConfig.PoolLimit = DefaultMaxPoolLimit
}
pxConfig.MaxConns = int32(dbConfig.PoolLimit)
pxConfig.MaxConns = dbConfig.PoolLimit
Copy link
Collaborator

@rverdile rverdile Oct 1, 2025

Choose a reason for hiding this comment

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

This works! but changing types here will also require changes in the backend. Let's fix this linting issue by checking the int max, instead of changing the type of dbConfig.PoolLimit to int32, like this: https://github.com/content-services/content-sources-backend/blob/93863b503e71c6bb93e10f1b2239887efc476c86/pkg/tasks/queue/pgqueue.go#L218-L220

@rverdile rverdile self-assigned this Oct 2, 2025
Validate that dbConfig.PoolLimit is within 32-bit integer range
(math.MinInt32 to math.MaxInt32) before converting to int32 to
prevent overflow issues.
Copy link
Collaborator

@rverdile rverdile left a comment

Choose a reason for hiding this comment

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

looks good! going to merge and release a new version. Then you'll be able to update your backend PR

@rverdile rverdile merged commit 08a4021 into content-services:main Oct 7, 2025
2 checks passed
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.

3 participants