Skip to content

Commit 6ea031c

Browse files
committed
PR feedback
1 parent 834a8cb commit 6ea031c

File tree

4 files changed

+10
-29
lines changed

4 files changed

+10
-29
lines changed

src/deploy/functions/runtimes/golang/index.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ export class Delegate {
130130
private readonly module: Module
131131
) {}
132132
validate(): Promise<void> {
133-
// throw new FirebaseError("Cannot yet analyze Go source code");
134-
return Promise.resolve();
133+
throw new FirebaseError("Cannot yet analyze Go source code");
135134
}
136135

137136
build(): Promise<void> {
@@ -155,25 +154,6 @@ export class Delegate {
155154
configValues: backend.RuntimeConfigValues,
156155
envs: backend.EnvironmentVariables
157156
): Promise<backend.Backend> {
158-
const stubbed: backend.Backend = {
159-
requiredAPIs: {},
160-
topics: [],
161-
schedules: [],
162-
cloudFunctions: [
163-
{
164-
apiVersion: 1,
165-
id: "HelloWorld",
166-
region: "us-central1",
167-
project: this.projectId,
168-
entryPoint: "HelloWorld",
169-
runtime: this.runtime,
170-
trigger: {
171-
allowInsecure: false,
172-
},
173-
},
174-
],
175-
environmentVariables: envs,
176-
};
177-
return Promise.resolve(stubbed);
157+
throw new FirebaseError("Cannot yet discover function specs");
178158
}
179159
}

src/deploy/functions/runtimes/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ import * as validate from "../validate";
77
import { FirebaseError } from "../../../error";
88

99
/** Supported runtimes for new Cloud Functions. */
10-
const RUNTIMES: string[] = ["nodejs10", "nodejs12", "nodejs14", "go113"];
11-
export type Runtime = typeof RUNTIMES[number];
10+
const RUNTIMES: string[] = ["nodejs10", "nodejs12", "nodejs14"]
11+
// Experimental runtimes are part of the Runtime type, but are in a
12+
// different list to help guard against some day accidentally iterating over
13+
// and printing a hidden runtime to the user.
14+
const EXPERIMENTAL_RUNTIMES = ["go113"];
15+
export type Runtime = typeof RUNTIMES[number] | typeof EXPERIMENTAL_RUNTIMES[number];
1216

1317
/** Runtimes that can be found in existing backends but not used for new functions. */
1418
const DEPRECATED_RUNTIMES = ["nodejs6", "nodejs8"];
@@ -21,7 +25,7 @@ export function isDeprecatedRuntime(runtime: string): runtime is DeprecatedRunti
2125

2226
/** Type deduction helper for a runtime string. */
2327
export function isValidRuntime(runtime: string): runtime is Runtime {
24-
return RUNTIMES.includes(runtime);
28+
return RUNTIMES.includes(runtime) || EXPERIMENTAL_RUNTIMES.includes(runtime);
2529
}
2630

2731
const MESSAGE_FRIENDLY_RUNTIMES: Record<Runtime | DeprecatedRuntime, string> = {

src/init/features/functions/golang.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ async function writeModFile(config: Config) {
9696
const extractArchive = unzipper.Extract({ path: config.path("functions/firebase-functions-go") });
9797
await promisify(stream.pipeline)(download.body, extractArchive);
9898

99-
// Should this come later as "would you like to install dependencies" to mirror Node?
100-
// It's less clearly distinct from node where you can edit the package.json file w/o installing.
101-
// Here we're actually locking in a version in go.mod _and_ installing it in one step.
10299
const result = spawn.sync("go", ["get", ADMIN_SDK], {
103100
cwd: config.path("functions"),
104101
stdio: "inherit",

templates/init/functions/golang/_gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
*.test
1010

1111
# Output of the go coverage tool, specifically when used with LiteIDE
12-
*.out
12+
*.out

0 commit comments

Comments
 (0)