The mismatch is usually caused by environment variable differences, specifically GODEBUG settings or CGO_ENABLED, which control runtime behavior and compilation flags. Run go env in both your local terminal and the CI logs to compare values like GODEBUG, CGO_ENABLED, and GOOS. If GODEBUG differs, add a godebug directive to your go.mod file to enforce consistent defaults across environments:
godebug (
default=go1.21
panicnil=1
)
If the issue involves C dependencies, ensure CGO_ENABLED is set to 1 in CI or install the required system libraries (e.g., gcc, glibc) in your CI runner.