Skip to content

Commit bff9e50

Browse files
davidkonigsbergdevin-ai-integration[bot]patrickthornton
authored
fix(go): preserve SDK version in dynamic snippets instead of using generator version (#14937)
* fix(go): preserve SDK version in dynamic snippets instead of using generator version Co-Authored-By: David Konigsberg <davidakonigsberg@gmail.com> * use util --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: patrick thornton <patrickthornton@g.harvard.edu>
1 parent 6dfd6a7 commit bff9e50

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

generators/go-v2/dynamic-snippets/src/context/DynamicSnippetsGeneratorContext.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
AbstractDynamicSnippetsGeneratorContext,
3-
type FernGeneratorExec
3+
type FernGeneratorExec,
4+
getSdkVersion
45
} from "@fern-api/browser-compatible-base-generator";
56
import { assertNever } from "@fern-api/core-utils";
67
import type { FernIr } from "@fern-api/dynamic-ir-sdk";
@@ -214,14 +215,16 @@ export class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGene
214215
if (publishInfo.type !== "go") {
215216
return config;
216217
}
218+
// Prefer --version flag over IR's publish version (which may be the generator version, not SDK version).
219+
const originalVersion = getSdkVersion(config);
217220
return {
218221
...config,
219222
customConfig: generatorConfig.customConfig ?? config.customConfig,
220223
output: {
221224
...config.output,
222225
mode: {
223226
type: "github",
224-
version: publishInfo.version,
227+
version: originalVersion ?? publishInfo.version,
225228
repoUrl: publishInfo.repoUrl
226229
} as FernGeneratorExec.OutputMode
227230
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- summary: |
2+
Fix dynamic snippets using the generator version instead of the SDK version
3+
for resolving Go import paths, which caused incorrect major version suffixes
4+
in wire test imports and broke go mod tidy.
5+
type: fix

0 commit comments

Comments
 (0)