@vercel/go 2.0.16 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -17898,8 +17898,8 @@ async function build({ files, entrypoint, config, workPath, meta = {}, }) {
17898
17898
  throw err;
17899
17899
  }
17900
17900
  }
17901
- const mainModGoFileName = 'main__mod__.go';
17902
- const modMainGoContents = await fs_extra_1.readFile(__webpack_require__.ab + "main__mod__.go", 'utf8');
17901
+ const mainModGoFileName = 'main.go';
17902
+ const modMainGoContents = await fs_extra_1.readFile(__webpack_require__.ab + "main.go", 'utf8');
17903
17903
  let goPackageName = `${packageName}/${packageName}`;
17904
17904
  const goFuncName = `${packageName}.${handlerFunctionName}`;
17905
17905
  if (isGoModExist) {
@@ -18000,8 +18000,10 @@ async function build({ files, entrypoint, config, workPath, meta = {}, }) {
18000
18000
  const go = await go_helpers_1.createGo(workPath, goPath, process.platform, process.arch, {
18001
18001
  cwd: entrypointDirname,
18002
18002
  }, false);
18003
- const origianlMainGoContents = await fs_extra_1.readFile(__webpack_require__.ab + "main.go", 'utf8');
18004
- const mainGoContents = origianlMainGoContents.replace('__VC_HANDLER_FUNC_NAME', handlerFunctionName);
18003
+ const originalMainGoContents = await fs_extra_1.readFile(__webpack_require__.ab + "main.go", 'utf8');
18004
+ const mainGoContents = originalMainGoContents
18005
+ .replace('"__VC_HANDLER_PACKAGE_NAME"', '')
18006
+ .replace('__VC_HANDLER_FUNC_NAME', handlerFunctionName);
18005
18007
  // in order to allow the user to have `main.go`,
18006
18008
  // we need our `main.go` to be called something else
18007
18009
  const mainGoFileName = 'main__vc__go__.go';
@@ -18040,6 +18042,7 @@ async function build({ files, entrypoint, config, workPath, meta = {}, }) {
18040
18042
  files: { ...(await build_utils_1.glob('**', outDir)), ...includedFiles },
18041
18043
  handler: handlerFileName,
18042
18044
  runtime: 'go1.x',
18045
+ supportsWrapper: true,
18043
18046
  environment: {},
18044
18047
  });
18045
18048
  const watch = parsedAnalyzed.watch;
package/dist/main.go CHANGED
@@ -1,10 +1,31 @@
1
1
  package main
2
2
 
3
3
  import (
4
- vc "github.com/vercel/go-bridge/go/bridge"
5
4
  "net/http"
5
+ "os"
6
+ "syscall"
7
+
8
+ "__VC_HANDLER_PACKAGE_NAME"
9
+ vc "github.com/vercel/go-bridge/go/bridge"
6
10
  )
7
11
 
12
+ func checkForLambdaWrapper() {
13
+ wrapper := os.Getenv("AWS_LAMBDA_EXEC_WRAPPER")
14
+ if wrapper == "" {
15
+ return
16
+ }
17
+
18
+ // Removing the env var doesn't work
19
+ // Set it to empty string to override the previous value
20
+ os.Setenv("AWS_LAMBDA_EXEC_WRAPPER", "")
21
+ argv := append([]string{wrapper}, os.Args...)
22
+ err := syscall.Exec(wrapper, argv, os.Environ())
23
+ if err != nil {
24
+ panic(err)
25
+ }
26
+ }
27
+
8
28
  func main() {
29
+ checkForLambdaWrapper()
9
30
  vc.Start(http.HandlerFunc(__VC_HANDLER_FUNC_NAME))
10
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/go",
3
- "version": "2.0.16",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
@@ -45,5 +45,5 @@
45
45
  "tar": "4.4.6",
46
46
  "typescript": "4.3.4"
47
47
  },
48
- "gitHead": "47e3381c6df661168e8be335cc58df03f3cf2414"
48
+ "gitHead": "31f79c7de1944420b1f6fa5be9235c9b3f1d62b6"
49
49
  }
@@ -1,12 +0,0 @@
1
- package main
2
-
3
- import (
4
- "__VC_HANDLER_PACKAGE_NAME"
5
- "net/http"
6
-
7
- vc "github.com/vercel/go-bridge/go/bridge"
8
- )
9
-
10
- func main() {
11
- vc.Start(http.HandlerFunc(__VC_HANDLER_FUNC_NAME))
12
- }