Skip to content

Commit

Permalink
Fix remaining cases of __filename (#1309)
Browse files Browse the repository at this point in the history
This was partially fixed in c458fe8.
Convert URL to path for pretty printing.
jhendrixMSFT authored Apr 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 9531967 commit 2dec79b
Showing 5 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/autorest.go/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 4.0.0-preview.66 (2024-04-25)

### Bugs Fixed

* Removed references to `__filename`.

## 4.0.0-preview.65 (2024-04-24)

### Bugs Fixed
2 changes: 1 addition & 1 deletion packages/autorest.go/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@autorest/go",
"version": "4.0.0-preview.65",
"version": "4.0.0-preview.66",
"description": "AutoRest Go Generator",
"main": "dist/autorest.go/src/main.js",
"type": "module",
3 changes: 2 additions & 1 deletion packages/autorest.go/src/generator/generator.ts
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ import { generateGoModFile } from '../../../codegen.go/src/gomod.js';
import { generateXMLAdditionalPropsHelpers } from '../../../codegen.go/src/xmlAdditionalProps.js';
import { generateServers } from '../../../codegen.go/src/fake/servers.js';
import { generateServerFactory } from '../../../codegen.go/src/fake/factory.js';
import { fileURLToPath } from 'url';

// The generator emits Go source code files to disk.
export async function generateCode(host: AutorestExtensionHost) {
@@ -214,7 +215,7 @@ export async function generateCode(host: AutorestExtensionHost) {
}
} catch (E) {
if (debug) {
console.error(`${import.meta.url} - FAILURE ${JSON.stringify(E)} ${(<Error>E).stack}`);
console.error(`${fileURLToPath(import.meta.url)} - FAILURE ${JSON.stringify(E)} ${(<Error>E).stack}`);
}
throw E;
}
3 changes: 2 additions & 1 deletion packages/autorest.go/src/m4togocodemodel/adapter.ts
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ import * as go from '../../../codemodel.go/src/gocodemodel.js';
import { adaptClients } from './clients.js';
import { adaptConstantType, adaptInterfaceType, adaptModel, adaptModelField } from './types.js';
import { aggregateProperties } from '../transform/helpers.js';
import { fileURLToPath } from 'url';

// converts an M4 code model into a GoCodeModel
export async function m4ToGoCodeModel(host: AutorestExtensionHost) {
@@ -88,7 +89,7 @@ export async function m4ToGoCodeModel(host: AutorestExtensionHost) {
});
} catch (E) {
if (debug) {
console.error(`${__filename} - FAILURE ${JSON.stringify(E)} ${(<Error>E).stack}`);
console.error(`${fileURLToPath(import.meta.url)} - FAILURE ${JSON.stringify(E)} ${(<Error>E).stack}`);
}
throw E;
}
3 changes: 2 additions & 1 deletion packages/autorest.go/src/transform/transform.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ import * as helpers from './helpers.js';
import { namer, protocolMethods } from './namer.js';
import { fromString } from 'html-to-text';
import showdown from 'showdown';
import { fileURLToPath } from 'url';
const { Converter } = showdown;

// The transformer adds Go-specific information to the code model.
@@ -35,7 +36,7 @@ export async function transformM4(host: AutorestExtensionHost) {

} catch (E) {
if (debug) {
console.error(`${__filename} - FAILURE ${JSON.stringify(E)} ${(<Error>E).stack}`);
console.error(`${fileURLToPath(import.meta.url)} - FAILURE ${JSON.stringify(E)} ${(<Error>E).stack}`);
}
throw E;
}

0 comments on commit 2dec79b

Please sign in to comment.