@vercel/go 2.1.0 → 2.1.1
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 +4 -7
- package/dist/main.go +1 -22
- package/dist/main__mod__.go +12 -0
- package/package.json +3 -3
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 = '
|
|
17902
|
-
const modMainGoContents = await fs_extra_1.readFile(__webpack_require__.ab + "
|
|
17901
|
+
const mainModGoFileName = 'main__mod__.go';
|
|
17902
|
+
const modMainGoContents = await fs_extra_1.readFile(__webpack_require__.ab + "main__mod__.go", 'utf8');
|
|
17903
17903
|
let goPackageName = `${packageName}/${packageName}`;
|
|
17904
17904
|
const goFuncName = `${packageName}.${handlerFunctionName}`;
|
|
17905
17905
|
if (isGoModExist) {
|
|
@@ -18000,10 +18000,8 @@ 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
|
|
18004
|
-
const mainGoContents =
|
|
18005
|
-
.replace('"__VC_HANDLER_PACKAGE_NAME"', '')
|
|
18006
|
-
.replace('__VC_HANDLER_FUNC_NAME', handlerFunctionName);
|
|
18003
|
+
const origianlMainGoContents = await fs_extra_1.readFile(__webpack_require__.ab + "main.go", 'utf8');
|
|
18004
|
+
const mainGoContents = origianlMainGoContents.replace('__VC_HANDLER_FUNC_NAME', handlerFunctionName);
|
|
18007
18005
|
// in order to allow the user to have `main.go`,
|
|
18008
18006
|
// we need our `main.go` to be called something else
|
|
18009
18007
|
const mainGoFileName = 'main__vc__go__.go';
|
|
@@ -18042,7 +18040,6 @@ async function build({ files, entrypoint, config, workPath, meta = {}, }) {
|
|
|
18042
18040
|
files: { ...(await build_utils_1.glob('**', outDir)), ...includedFiles },
|
|
18043
18041
|
handler: handlerFileName,
|
|
18044
18042
|
runtime: 'go1.x',
|
|
18045
|
-
supportsWrapper: true,
|
|
18046
18043
|
environment: {},
|
|
18047
18044
|
});
|
|
18048
18045
|
const watch = parsedAnalyzed.watch;
|
package/dist/main.go
CHANGED
|
@@ -1,31 +1,10 @@
|
|
|
1
1
|
package main
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
"net/http"
|
|
5
|
-
"os"
|
|
6
|
-
"syscall"
|
|
7
|
-
|
|
8
|
-
"__VC_HANDLER_PACKAGE_NAME"
|
|
9
4
|
vc "github.com/vercel/go-bridge/go/bridge"
|
|
5
|
+
"net/http"
|
|
10
6
|
)
|
|
11
7
|
|
|
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
|
-
|
|
28
8
|
func main() {
|
|
29
|
-
checkForLambdaWrapper()
|
|
30
9
|
vc.Start(http.HandlerFunc(__VC_HANDLER_FUNC_NAME))
|
|
31
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/go",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/jest": "28.1.6",
|
|
36
36
|
"@types/node-fetch": "^2.3.0",
|
|
37
37
|
"@types/tar": "^4.0.0",
|
|
38
|
-
"@vercel/build-utils": "5.3.
|
|
38
|
+
"@vercel/build-utils": "5.3.1",
|
|
39
39
|
"@vercel/ncc": "0.24.0",
|
|
40
40
|
"async-retry": "1.3.1",
|
|
41
41
|
"execa": "^1.0.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"tar": "4.4.6",
|
|
46
46
|
"typescript": "4.3.4"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "b52d01f809b80734ed1ab61df82f299f11a04720"
|
|
49
49
|
}
|