Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a85a74c
Go emitter migrate to typespec-azure repo
Jun 15, 2026
318d074
fix lint
Jun 15, 2026
9766f31
Merge remote-tracking branch 'origin/main' into go-migration
Jun 15, 2026
f9acb87
fix(ci-go): quote command substitutions to satisfy shellcheck SC2086
Jun 15, 2026
3c03b63
fix(typespec-go): fix spelling typos and configure cspell
Jun 15, 2026
ff41435
fix(cspell): lowercase Go emitter words for case-insensitive matching
Jun 15, 2026
22d28c5
chore: sync labels for emitter:go
Jun 15, 2026
f184a20
fix(ci-go): use full pnpm install for unit/docs jobs
Jun 15, 2026
2bec532
fix(typespec-go): un-ignore test fixtures required by regenerate
Jun 15, 2026
cbd0588
chore: re-sync labels to align emitter order with eng/config/labels.ts
Jun 15, 2026
8913669
update
Jun 15, 2026
db99e1a
chore: sync CONTRIBUTING.md banner with sync-labels script output
Jun 15, 2026
788114b
feat(typespec-go): auto-sync generated tests with azure-sdk-assets ba…
Jun 15, 2026
dd74d9a
docs(typespec-go): document syncBaseline conflict semantics
Jun 15, 2026
c0e06fa
build: add go to mise tools
Jun 15, 2026
52b6d86
update
Jun 15, 2026
33fbf2f
update lock file
Jun 15, 2026
f521ecb
fix(typespec-go): drop stale source-map-support import
Jun 15, 2026
c92d47b
docs(typespec-go): add development guide
Jun 16, 2026
881fb8f
docs(typespec-go): build via turbo, not tsc directly
Jun 16, 2026
5fd74f2
docs(typespec-go): document installing golangci-lint and shadow locally
Jun 16, 2026
e471cb6
refine doc
Jun 16, 2026
f07167b
update cspell
Jun 16, 2026
81707a2
test(typespec-go): run go tests across local, http-specs, azure-http-…
Jun 16, 2026
8bfba84
fix(typespec-go): discover go tests by module to skip disabled specs
Jun 16, 2026
f1af5c6
test(typespec-go): lint all test roots; drop redundant test-file filter
Jun 16, 2026
9511cbe
refine doc
Jun 16, 2026
f59b155
Use adapted type when adapting a literal enum value
Jun 22, 2026
955ce9a
Merge remote-tracking branch 'origin/main' into go-migration
Jun 25, 2026
992ed89
Merge remote-tracking branch 'origin/main' into go-migration
Jul 1, 2026
483ca99
build: update pnpm-lock.yaml for merged core submodule
Jul 1, 2026
8904cd8
format
Jul 1, 2026
3759486
fix(typespec-go): resolve lint failures (deprecation warnings + OOM)
Jul 1, 2026
8a84128
revert
tadelesh Jul 2, 2026
35af6d2
Merge branch 'main' into go-migration
tadelesh Jul 2, 2026
538e211
fix merge issue
tadelesh Jul 2, 2026
d9cd537
chore: regenerate label policy files via sync-labels
Jul 2, 2026
298a2f7
test(typespec-go): disable armcognitiveservices regen (TCGC override …
Jul 2, 2026
12e847f
Merge remote-tracking branch 'origin/main' into go-migration
Jul 6, 2026
86dd12d
remove all arm tests
Jul 7, 2026
6300d67
ci: migrate sdk-regenerate pipeline from autorest.go
Jul 7, 2026
f63d29b
Revert "ci: migrate sdk-regenerate pipeline from autorest.go"
Jul 7, 2026
0197331
Merge remote-tracking branch 'origin/main' into go-migration
Jul 8, 2026
1617ded
test(typespec-go): migrate emitter integration tests to markdown snap…
Jul 8, 2026
9859d5b
format
Jul 8, 2026
502576f
Merge branch 'main' into go-migration
tadelesh Jul 8, 2026
75040b4
build(typespec-go): add `pnpm test:update` to regenerate scenario sna…
Jul 9, 2026
76116b0
build(typespec-go): prune unused azure-rest-api-specs sparse paths
Jul 9, 2026
81fd368
docs(typespec-go): reflow development guide and fix lint scope
Jul 9, 2026
81c5409
docs(typespec-go): clarify what `pnpm regenerate` covers under test/
Jul 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Comment thread
tadelesh marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
Comment thread
tadelesh marked this conversation as resolved.
Outdated
packages:
- "@azure-tools/typespec-go"
---

Move `@azure-tools/typespec-go` from `Azure/autorest.go` into `Azure/typespec-azure`. The previously-private workspace packages `@azure-tools/codegen.go`, `@azure-tools/codemodel.go`, and `@azure-tools/naming.go` are now inlined into `src/codegen`, `src/codemodel`, and `src/naming` respectively. No behavior changes for emitter consumers.
21 changes: 21 additions & 0 deletions .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Setup Go
Comment thread
tadelesh marked this conversation as resolved.
description: Setup Go for typespec-go package development and CI
inputs:
go-version:
required: false
description: Go version for setup-go
default: "1.26.1"

runs:
using: composite

steps:
- name: Setup Go ${{ inputs.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}
cache: false

- name: Log Go version
shell: bash
run: go version
127 changes: 127 additions & 0 deletions .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: "go / test e2e"
Comment thread
tadelesh marked this conversation as resolved.

on:
pull_request:
branches:
- main
- release/*
paths:
- "packages/typespec-go/**"
- ".github/workflows/ci-go.yml"
- ".github/actions/setup-go/**"
merge_group:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: ./.github/actions/setup

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm turbo run --filter "@azure-tools/typespec-go..." build

test:
name: "Mock API Tests (Go ${{ matrix.go-version }})"
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ["1.26.1", "1.25.8"]
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: ./.github/actions/setup

- uses: ./.github/actions/setup-go
with:
go-version: ${{ matrix.go-version }}

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm turbo run --filter "@azure-tools/typespec-go..." build

- name: Build spector and specs
run: |
pnpm turbo run --filter "@typespec/spector..." build
pnpm --filter "@typespec/http-specs" exec tsc -p ./tsconfig.build.json
pnpm --filter "@azure-tools/azure-http-specs" exec tsc -p ./tsconfig.build.json

- name: Install Go lint tools
run: |
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.11.4
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH

- name: Regenerate
run: pnpm run regenerate
working-directory: packages/typespec-go

- name: Lint
run: pnpm run lint:go
working-directory: packages/typespec-go

- name: Run Go e2e tests against spector
run: pnpm run test:go:e2e
working-directory: packages/typespec-go

unit:
name: "Unit Tests"
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: ./.github/actions/setup

- name: Install dependencies
run: pnpm install --filter "@azure-tools/typespec-go..."

- name: Build
run: pnpm turbo run --filter "@azure-tools/typespec-go..." build

- name: Test
run: pnpm run test:ci
working-directory: packages/typespec-go

docs:
name: "Docs Validation"
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: ./.github/actions/setup

- name: Install dependencies
run: pnpm install --filter "@azure-tools/typespec-go..."

- name: Build
run: pnpm turbo run --filter "@azure-tools/typespec-go..." build

- name: Regenerate emitter docs
run: pnpm run regen-docs
working-directory: packages/typespec-go
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,10 @@ packages/samples/test/output/azure/templates-contoso/setup.*
# python emitter
packages/typespec-python/tests/generated/**
packages/typespec-python/alpha

# go emitter
packages/typespec-go/test/**/zz_*.go
packages/typespec-go/test/**/go.mod
packages/typespec-go/test/**/go.sum
packages/typespec-go/test/**/LICENSE.txt
packages/typespec-go/test/**/testdata
5 changes: 5 additions & 0 deletions eng/config/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export const AreaLabels = defineLabels({
color: "957300",
description: "Issues for @azure-tools/typespec-python emitter",
},
"emitter:go": {
color: "957300",
description: "Issues for @azure-tools/typespec-go emitter",
},
"emitter:typescript": {
color: "957300",
description: "Issues for @azure-tools/typespec-ts emitter",
Expand Down Expand Up @@ -67,6 +71,7 @@ export const AreaPaths: Record<keyof typeof AreaLabels, string[]> = {
"lib:azure-resource-manager": ["packages/typespec-azure-resource-manager/"],
"emitter:autorest": ["packages/typespec-autorest/"],
"emitter:python": ["packages/typespec-python/"],
"emitter:go": ["packages/typespec-go/"],
"emitter:typescript": ["packages/typespec-ts/"],
"lib:tcgc": ["packages/typespec-client-generator-core/"],
"lib:azure-http-specs": ["packages/azure-http-specs/"],
Expand Down
19 changes: 19 additions & 0 deletions eng/pipelines/jobs/build-for-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ jobs:
PackagePath: packages/typespec-python
GeneratorName: "@azure-tools/typespec-python"

# Go e2e tests and spector coverage upload
- task: GoTool@0
displayName: "Use Go 1.26.1"
inputs:
version: "1.26.1"

- script: pnpm run regenerate
displayName: "Regenerate Go test code"
workingDirectory: packages/typespec-go

- script: pnpm run test:go:e2e
displayName: "Run Go e2e tests"
workingDirectory: packages/typespec-go

- template: /eng/pipelines/templates/upload-spector-coverage.yml
parameters:
PackagePath: packages/typespec-go
GeneratorName: "@azure-tools/typespec-go"

- template: /eng/pipelines/templates/pack.yml
parameters:
artifactName: npm-packages-stable
Expand Down
25 changes: 25 additions & 0 deletions packages/typespec-go/.scripts/azure-rest-api-specs.json
Comment thread
tadelesh marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "./azure-rest-api-specs.schema.json",
"_description": "Pinned commit of Azure/azure-rest-api-specs used by .scripts/sync-azure-rest-api-specs.js and tspcompile.js. To update specs, change `commit` to a newer SHA from https://github.com/Azure/azure-rest-api-specs/commits/main, then run `pnpm tspcompile`.",
"repository": "https://github.com/Azure/azure-rest-api-specs.git",
"commit": "f437f2fe14e41383b15850c619b599468333007b",
"sparseCheckoutPaths": [
"specification/apicenter/ApiCenter.Management",
"specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/AzureLargeInstance",
"specification/billingbenefits/BillingBenefits.Management",
"specification/codesigning/CodeSigning.Management",
"specification/cognitiveservices/CognitiveServices.Management",
"specification/communitytraining/Community.Management",
"specification/computeschedule/ComputeSchedule.Management",
"specification/databasewatcher/DatabaseWatcher.Management",
"specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure.Management",
"specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/HardwareSecurityModules",
"specification/healthbot/HealthBot.Management",
"specification/keyvault/data-plane/Keys",
"specification/kubernetesruntime/KubernetesRuntime.Management",
"specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting",
"specification/mongocluster/resource-manager/Microsoft.DocumentDB/MongoCluster",
"specification/oracle/Oracle.Database.Management",
"specification/storage/data-plane/BlobStorage"
]
}
49 changes: 49 additions & 0 deletions packages/typespec-go/.scripts/go-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Runs `go test ./...` under every directory below test/local/ that contains
// `_test.go` files. Assumes the tsp-spector mock server is already running;
// use `pnpm spector --start`/`--stop` (see spector.js) to manage it.

import { spawnSync } from "child_process";
import { existsSync, readdirSync, statSync } from "fs";
import { dirname, resolve } from "path";
import { fileURLToPath } from "url";

const scriptDir = dirname(fileURLToPath(import.meta.url));
const pkgRoot = resolve(scriptDir, "..");
const testLocal = resolve(pkgRoot, "test", "local");
Comment thread
tadelesh marked this conversation as resolved.
Outdated

function findTestDirs(root) {
const dirs = new Set();
if (!existsSync(root)) return [];
const walk = (dir) => {
for (const entry of readdirSync(dir)) {
const p = resolve(dir, entry);
if (statSync(p).isDirectory()) walk(p);
else if (entry.endsWith("_test.go")) dirs.add(dir);
}
};
walk(root);
return [...dirs].sort();
}

const dirs = findTestDirs(testLocal);
console.log(`Discovered ${dirs.length} go test directories under ${testLocal}`);

let failed = false;
for (const dir of dirs) {
console.log(`\n=== go test ./... in ${dir} ===`);
const result = spawnSync("go", ["test", "-run", "^Test", "-v", "./..."], {
cwd: dir,
stdio: "inherit",
});
if (result.status !== 0) {
console.error(`go test failed in ${dir}`);
failed = true;
}
}

if (failed) {
process.exit(1);
}
57 changes: 57 additions & 0 deletions packages/typespec-go/.scripts/lint-go.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Runs golangci-lint and shadow against every Go module under test/local/.
// Expects golangci-lint and `shadow` to be available on PATH (installed by CI).

import { spawnSync } from "child_process";
import { existsSync, readdirSync, statSync } from "fs";
import { dirname, resolve } from "path";
import { fileURLToPath } from "url";

const scriptDir = dirname(fileURLToPath(import.meta.url));
const pkgRoot = resolve(scriptDir, "..");
const testLocal = resolve(pkgRoot, "test", "local");

function findModuleDirs(root) {
const dirs = new Set();
if (!existsSync(root)) return [];
const walk = (dir) => {
for (const entry of readdirSync(dir)) {
const p = resolve(dir, entry);
if (entry === "go.mod" && !statSync(p).isDirectory()) {
dirs.add(dir);
return;
}
}
for (const entry of readdirSync(dir)) {
const p = resolve(dir, entry);
if (statSync(p).isDirectory()) walk(p);
}
};
walk(root);
return [...dirs].sort();
}

const dirs = findModuleDirs(testLocal);
console.log(`Linting ${dirs.length} go modules under ${testLocal}`);

let failed = false;
for (const dir of dirs) {
console.log(`\n=== golangci-lint in ${dir} ===`);
let result = spawnSync("golangci-lint", ["run", "./..."], { cwd: dir, stdio: "inherit" });
if (result.status !== 0) {
console.error(`golangci-lint failed in ${dir}`);
failed = true;
}
console.log(`=== shadow in ${dir} ===`);
result = spawnSync("shadow", ["./..."], { cwd: dir, stdio: "inherit" });
if (result.status !== 0) {
console.error(`shadow failed in ${dir}`);
failed = true;
}
}

if (failed) {
process.exit(1);
}
Loading
Loading