Skip to content

fix(go): gracefully handle go fmt failures during generation#11504

Merged
fern-support merged 1 commit intomainfrom
devin/1768255911-go-sdk-graceful-fmt
Jan 13, 2026
Merged

fix(go): gracefully handle go fmt failures during generation#11504
fern-support merged 1 commit intomainfrom
devin/1768255911-go-sdk-graceful-fmt

Conversation

@jsklan
Copy link
Copy Markdown
Contributor

@jsklan jsklan commented Jan 12, 2026

Description

Refs: Discussion in #sdk-dev about Go SDK generation failures when go fmt encounters issues

When generating Go SDKs, if go fmt fails (e.g., due to .fernignore issues or other compilation problems), the entire generation would fail, preventing developers from seeing the generated output for debugging purposes.

This PR changes the behavior to gracefully handle go fmt failures by logging a warning and continuing to output the generated files.

Link to Devin run: https://app.devin.ai/sessions/cbb28720e3c14b2da2e8dc88d8caffdd
Requested by: @jsklan

Changes Made

  • Wrapped the go fmt execution in a try-catch block in GoProject.ts
  • When go fmt fails, logs a warning message instead of throwing an error
  • Files are still written to disk even if formatting fails
  • Added changelog entry for version 1.22.5

Testing

  • Lint checks pass (pnpm run check)
  • Unit tests added/updated (no new tests - behavior change is straightforward)
  • Manual testing completed (not tested with actual failing go fmt scenario)

Human Review Checklist

  • Verify the warning message is clear and actionable
  • Consider if this behavior should be configurable (current implementation always continues on failure)
  • Note: Users who want strict compilation guarantees should add go build ./... as a CI step in their SDK repo

Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@fern-support fern-support merged commit 49f5653 into main Jan 13, 2026
135 of 136 checks passed
@fern-support fern-support deleted the devin/1768255911-go-sdk-graceful-fmt branch January 13, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants