Skip to content

x/pkgsite: update codec generation for ast changes #76350

@findleyr

Description

@findleyr

In https://go.dev/issue/76031, we added a new field to ast.BasicLit. Meanwhile, pkgsite encodes the AST in binary.

The new field therefore either breaks pkgsite encoding of package source (see internal/unit.Documentation.Source), or makes our codec generation stale (running go generate ./internal/godoc/... results in a diff adding the encoding/decoding of the new field (here)

Many questions to answer:

  • How does changing our encoding version work?
  • Can we update the codec without regenerating all documentation (a rather expensive endeavor at this point).
  • Should we punt on updating the codec, and add a mechanism in generation that skips this field? The new field is ValueEnd, and if it's 0 it degenerates to the old behavior.
  • What do we do in the future if there was a nontrivial change to the AST that warranted a new encoding version?

@ethanalee-work would you mind looking into this? I don't think it's urgent (I'll fix the failing test), but we should at the very least update pkgsite so that go generate ./... is clean. Ideally, we'd also brainstorm here what to actually do if we need to update the encoding. (Apologies if this is already documented somewhere and I missed it).

CC @jba @nicholashusin @adonovan

Metadata

Metadata

Labels

FeatureRequestIssues asking for a new feature that does not need a proposal.pkgsite

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions