Skip to content

8 compile-grade TypeScript/Go code snippet defects across content/docs #21075

Description

@workprentice

Summary

A compile-grade sweep of TypeScript/JavaScript and Go fenced code snippets across content/docs/** (excluding auto-generated CLI reference pages and the trees already covered by PR #21022 and PR #21074) found 8 real, reproducible defects across 6 files. Each was confirmed with a real compiler/formatter (tsc --noEmit for TS/JS, gofmt -e for Go) against a positive control, not by pattern matching: a hand-built fixture containing a deliberate syntax error was confirmed to trip the same detector before the sweep ran, and every finding below was independently re-verified by hand-fixing the snippet and re-running the same tool to a clean pass.

TypeScript / JavaScript (tsc --noEmit, TS1xxx syntax diagnostics only)

  1. content/docs/iac/guides/clouds/aws/lambda.md:391 — the onObjectCreated("docsHandler", new aws.lambda.CallbackFunction("docsHandlerFunc", { ... }) call closes with }); but is missing one closing parenthesis for the outer onObjectCreated( call. Should be }));.
  2. content/docs/iac/guides/clouds/aws/lambda.md:581export docsBucketName = docsBucket.bucketName; is missing the const keyword; should be export const docsBucketName = docsBucket.bucketName;.
  3. content/docs/iac/concepts/functions/function-serialization.md:164const obj = { foo() { console.log("foo called"); } bar() { console.log("bar called") } }; is missing a comma between the two object method shorthand definitions (foo() and bar()).
  4. content/docs/iac/concepts/functions/function-serialization.md:176 — the same missing-comma defect, second occurrence: const obj = { foo() { console.log("foo called"); this.bar(); } bar() { console.log("bar called") } };.

Go (gofmt -e)

  1. content/docs/iac/guides/migration/migrating-to-pulumi/from-cloudformation.md (Go tab, around line 344) — the backtick-delimited raw string literal holding the CloudFormation JSON template is never closed; the closing backtick before the ) ending the const block is missing.
  2. content/docs/iac/guides/migration/migrating-to-pulumi/from-cloudformation.md (Go tab, around line 546) — the ec2.NewVpc(...) call closes with a stray extra } before the final ) (}) where just ) is needed), left over from an edit that restructured the call's arguments.
  3. content/docs/idp/guides/publishing-from-github-actions.md:134,146,170 — three occurrences of err: = (a stray space splitting the := short variable declaration token in two) instead of err := . Go does not accept : = as equivalent to :=.
  4. content/docs/idp/concepts/private-registry.md:145 — a Go string literal contains unescaped double quotes ("...Valid values are "small", "medium", "large", "xlarge"..."), which breaks the string literal. The inner quotes need escaping.

Reproduction

Each snippet was extracted verbatim from its fenced code block and run through the real tool:

  • TypeScript/JavaScript: concatenated per-page fences into virtual .ts files, ran tsc --noEmit against a minimal tsconfig.json (skipLibCheck: true, wildcard ambient module stubs for @pulumi/*/@aws-sdk/* so imports resolve). Only TS1xxx (syntax-level) diagnostics were treated as confirmed defects; TS2304/TS2552 "cannot find name" diagnostics were excluded as low-confidence, since docs snippets legitimately reference identifiers introduced elsewhere on the page.
  • Go: ran gofmt -e on each snippet (wrapped in package main / func main() as needed to make it parseable in isolation, hoisting any import blocks unchanged).

Scope note

This sweep excluded content/docs/cli/** (auto-generated), content/docs/iac/concepts/** (covered by a prior Go/Java sweep, issue #21042), content/docs/iac/get-started/aws/** (covered by PR #21022), and the five files touched by open PR #21074, to avoid overlapping or conflicting with in-flight work. A C#/Java compile-grade pass was attempted but no dotnet/javac toolchain was available in this environment; that remains an open coverage gap for a future pass.

Labels

area/docs-content, kind/bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions