TykTechnologies / tyk

Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols
Other
9.51k stars 1.07k forks source link

[TT-12234]update go1.21 version #6385

Closed jeffy-mathew closed 1 month ago

jeffy-mathew commented 1 month ago

User description

Description

Pin go version to go1.21.11

Related Issue

https://tyktech.atlassian.net/browse/TT-12234

Motivation and Context

How This Has Been Tested

Screenshots (if appropriate)

Types of changes

Checklist


PR Type

enhancement, configuration changes


Description


Changes walkthrough πŸ“

Relevant files
Configuration changes
Dockerfile
Update Go version in Dockerfile to 1.21.11                             

Dockerfile - Updated `GO_VERSION` argument from `1.21.4` to `1.21.11`.
+2/-2     
Enhancement
go.mod
Update Go version in go.mod to 1.21.11                                     

go.mod
  • Updated Go toolchain version from 1.21.4 to 1.21.11.
  • Updated Go version from 1.21.0 to 1.21.11.
  • +1/-3     

    πŸ’‘ PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    github-actions[bot] commented 1 month ago

    PR Reviewer Guide πŸ”

    ⏱️ Estimated effort to review [1-5] 2
    πŸ§ͺ Relevant tests No
    πŸ”’ Security concerns No
    ⚑ Key issues to review Version Consistency:
    Ensure that the version change from GO_VERSION=1.21.4 to GO_VERSION=1.21.11 in the Dockerfile does not introduce any compatibility issues with existing dependencies or project requirements.
    Dependency Management:
    The removal of the 'toolchain' directive in the go.mod file should be verified to ensure it does not affect the build or deployment processes.
    github-actions[bot] commented 1 month ago

    API Changes

    no api changes detected
    github-actions[bot] commented 1 month ago

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Use a global ARG for GO_VERSION to maintain consistency and ease of updates ___ **To ensure that the GO_VERSION is consistent across different stages in the Dockerfile,
    consider using a global ARG instruction at the top of the Dockerfile before the first FROM
    instruction. This allows you to maintain the version in one place, making the Dockerfile
    easier to update and maintain.** [Dockerfile [8-9]](https://github.com/TykTechnologies/tyk/pull/6385/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R8-R9) ```diff +ARG GO_VERSION=1.21.11 +ARG PYTHON_VERSION=3.11.6 - ```
    Suggestion importance[1-10]: 9 Why: This suggestion improves maintainability by ensuring that the `GO_VERSION` is consistent across different stages in the Dockerfile, making it easier to update and maintain.
    9
    Add --no-cache to the apt update command to ensure fresh package data ___ **To avoid potential caching issues and ensure that the latest packages are used during the
    build, consider adding --no-cache to the apt update command.** [Dockerfile [16]](https://github.com/TykTechnologies/tyk/pull/6385/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R16-R16) ```diff -RUN apt update && apt install wget -y && \ +RUN apt update --no-cache && apt install wget -y && \ ```
    Suggestion importance[1-10]: 8 Why: Adding `--no-cache` to the `apt update` command is a good practice to avoid potential caching issues and ensure that the latest packages are used during the build, enhancing reliability.
    8
    Possible issue
    Verify and ensure the Go version in go.mod is stable and compatible ___ **Ensure that the Go version specified in the go.mod file matches the latest stable release
    or a version that is supported by all dependencies to avoid potential compatibility
    issues. Verify that 1.21.11 is a valid and stable version.** [go.mod [3]](https://github.com/TykTechnologies/tyk/pull/6385/files#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6R3-R3) ```diff +go 1.21.11 - ```
    Suggestion importance[1-10]: 7 Why: While the suggestion is valid, it is more of a reminder to verify the version rather than a concrete improvement to the code. It is important to ensure compatibility, but the suggestion does not provide a specific actionable change.
    7
    Maintainability
    Add a comment explaining the choice of Go version in the Dockerfile ___ **Consider adding a comment next to the GO_VERSION argument to document why this specific
    version is chosen, especially if it is a significant update. This can be helpful for
    future maintenance or updates.** [Dockerfile [8]](https://github.com/TykTechnologies/tyk/pull/6385/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R8-R8) ```diff -ARG GO_VERSION=1.21.11 +ARG GO_VERSION=1.21.11 # Updated to 1.21.11 to utilize new features and improvements in this version ```
    Suggestion importance[1-10]: 6 Why: Adding comments for version choices can aid in future maintenance, but it is not crucial for functionality. This suggestion improves code readability and maintainability.
    6
    sonarcloud[bot] commented 1 month ago

    Quality Gate Passed Quality Gate passed

    Issues
    0 New issues
    0 Accepted issues

    Measures
    0 Security Hotspots
    0.0% Coverage on New Code
    0.0% Duplication on New Code

    See analysis details on SonarCloud