-
Notifications
You must be signed in to change notification settings - Fork 239
feat(functions):troubleshoot go version #4909
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: main
Are you sure you want to change the base?
Conversation
pages/serverless-functions/troubleshooting/go-function-version-error.mdx
Outdated
Show resolved
Hide resolved
pages/serverless-functions/troubleshooting/go-function-version-error.mdx
Outdated
Show resolved
Hide resolved
Co-authored-by: Benedikt Rollik <[email protected]>
|
||
## Problem | ||
|
||
My Go Serverless Function build failed with an error message about the wrong version. |
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.
My Go Serverless Function build failed with an error message about the wrong version. | |
My Go Serverless Function build failed with an error message mentioning a wrong version. |
When deploying a Go function, build step can fail with an error about the version of code versus version of the runtime even if the version seems correct. | ||
|
||
This is due to the `go.mod` directive that specify a `X.Y.Z` version where the `Z` version does not match. | ||
|
||
This happens by default because in go toolchain, the `go mod init` command now adds the version. |
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.
When deploying a Go function, build step can fail with an error about the version of code versus version of the runtime even if the version seems correct. | |
This is due to the `go.mod` directive that specify a `X.Y.Z` version where the `Z` version does not match. | |
This happens by default because in go toolchain, the `go mod init` command now adds the version. | |
Go function deployment may fail during the build step with a version mismatch error, even if the runtime version appears to be correct. | |
This is due to the `go.mod` directive that specifies an `X.Y.Z` version where the `Z` patch version does not match the version of the selected runtime. | |
This happens by default because the `go mod init` command includes the full Go version (including the patch version), which can lead to this mismatch if your runtime only supports a different patch version. |
Remove the `Z` version from the gomod. | ||
|
||
Wrong go.mod example: |
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.
Remove the `Z` version from the gomod. | |
Wrong go.mod example: | |
Remove the `Z` version from the `go.mod` file. In the example below, `X` corresponds to `1`, `Y` to `24`, and `Z` to `1`. | |
Content of a `go.mod` file with an incorrect `X.Y.Z` (`1.24.1`) version. |
go 1.24.1 | ||
``` | ||
|
||
Fixed: |
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.
Fixed: | |
The example below shows the content of the `go.mod` file after we have remove the incorrect `Z` version: |
Your checklist for this pull request
Description
Please describe what you added or changed.