Skip to content

build: bump golang image to 1.27.1 and prepare code for Go 1.27 - #4505

Open
stevenvegt wants to merge 2 commits into
masterfrom
chore/go127-readiness
Open

build: bump golang image to 1.27.1 and prepare code for Go 1.27#4505
stevenvegt wants to merge 2 commits into
masterfrom
chore/go127-readiness

Conversation

@stevenvegt

@stevenvegt stevenvegt commented Sep 9, 2026

Copy link
Copy Markdown
Member

Supersedes #4461 (same Dockerfile change) and includes the fixes needed to make it pass. The go-did fix has been released as v0.22.1, so this is ready for review.

Why #4461 fails

Building with Go 1.27 changes two standard-library behaviours that the unit tests do not cover (the test job uses the go.mod toolchain, only the Docker build uses the image's Go):

  1. encoding/json is now backed by encoding/json/v2 (release notes). go-did's CredentialStatus.UnmarshalJSON used type alias *CredentialStatus; the v2-backed decoder resolves the method through the pointer alias and recurses until fatal error: stack overflow. Every credential with a credentialStatus crashed the node, which is the Empty reply from server in the redis e2e job. Fixed in fix(vc): avoid infinite recursion in CredentialStatus.UnmarshalJSON on Go 1.27 go-did#163, released in go-did v0.22.1.
  2. pkix.Name.String now renders string attributes with unrecognized OIDs as text instead of hex (crypto/x509/pkix: Name.String() hex-encodes string-type ExtraNames golang/go#33093). The denylist tests hardcoded the old hex form of the emailAddress attribute in the banned certificate's issuer, so certificate is banned was no longer returned in the tests. The production denylist currently has one entry with a CN-only issuer, so live matching is unaffected, but future entries whose issuer has such attributes will only match nodes on the same Go generation.

Two more differences are cosmetic: json prints an invalid byte as \xd7 instead of ×, and nested type errors say into .0 of type instead of into Go value of type. Those tests now assert on the stable parts of the message.

Changes

Verification

GOTOOLCHAIN=go1.27.1 go test ./... and the Go 1.26.5 run both pass locally with go-did v0.22.1, except TestNetwork_checkHealth, which fails in my local environment on master as well. The e2e job on this PR is the actual check for the crash.

Follow-up

V6.2 and V5.4 need go-did v0.22.1 on their pinned go-did lines before their Go image can move to 1.27.

Go 1.27 backs encoding/json with encoding/json/v2 and changes how
pkix.Name.String renders attributes with unrecognized OIDs. Both break
nuts-node when built with the golang:1.27.1 image while the unit tests
(run with the go.mod toolchain) stay green:

- go-did's CredentialStatus.UnmarshalJSON recursed until stack overflow
  under json/v2, crashing the node on any credential that carries a
  credentialStatus. Bump go-did to the commit that fixes this (to be
  replaced by the tagged release).
- The denylist test hardcoded the pre-1.27 hex rendering of the
  emailAddress attribute in the banned certificate's issuer; derive it
  from the certificate instead.
- json error messages changed wording for invalid bytes and nested type
  errors; assert on the stable parts only.

Assisted-by: AI
Replaces the pseudo-version of the CredentialStatus fix (go-did#163)
with the tagged release that contains it.

Assisted-by: AI
@stevenvegt
stevenvegt marked this pull request as ready for review September 9, 2026 11:55
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.

1 participant