@vercel/go 3.2.0 → 3.2.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.
Files changed (2) hide show
  1. package/dist/index.js +20 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -18696,8 +18696,13 @@ async function findGoWorkFile(goWorkDir, workPath) {
18696
18696
  async function writeGoWork(destDir, workPath, modulePath) {
18697
18697
  const workspaces = /* @__PURE__ */ new Set(["."]);
18698
18698
  const goWorkPath = await findGoWorkFile(modulePath || workPath, workPath);
18699
+ let goVersion;
18699
18700
  if (goWorkPath) {
18700
18701
  const contents2 = await (0, import_fs_extra2.readFile)(goWorkPath, "utf-8");
18702
+ const goVersionMatch = contents2.match(/^go\s+(\d+\.\d+(\.\d+)?)/m);
18703
+ if (goVersionMatch) {
18704
+ goVersion = goVersionMatch[1];
18705
+ }
18701
18706
  const addPath = (path) => {
18702
18707
  if (path) {
18703
18708
  if (path.startsWith(".")) {
@@ -18725,8 +18730,22 @@ async function writeGoWork(destDir, workPath, modulePath) {
18725
18730
  }
18726
18731
  } else if (modulePath) {
18727
18732
  workspaces.add((0, import_path2.relative)(destDir, modulePath));
18733
+ const goModPath = (0, import_path2.join)(modulePath, "go.mod");
18734
+ if (await (0, import_fs_extra2.pathExists)(goModPath)) {
18735
+ const goModContents = await (0, import_fs_extra2.readFile)(goModPath, "utf-8");
18736
+ const goVersionMatch = goModContents.match(/^go\s+(\d+\.\d+(\.\d+)?)/m);
18737
+ if (goVersionMatch) {
18738
+ goVersion = goVersionMatch[1];
18739
+ }
18740
+ }
18741
+ }
18742
+ let contents = "";
18743
+ if (goVersion) {
18744
+ contents += `go ${goVersion}
18745
+
18746
+ `;
18728
18747
  }
18729
- const contents = `use (
18748
+ contents += `use (
18730
18749
  ${Array.from(workspaces).map((w) => ` ${w}
18731
18750
  `).join("")})
18732
18751
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/go",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
@@ -23,7 +23,7 @@
23
23
  "@types/node-fetch": "^2.3.0",
24
24
  "@types/tar": "6.1.5",
25
25
  "@types/yauzl-promise": "2.1.0",
26
- "@vercel/build-utils": "8.4.10",
26
+ "@vercel/build-utils": "8.4.12",
27
27
  "async-retry": "1.3.3",
28
28
  "execa": "^1.0.0",
29
29
  "fs-extra": "^7.0.0",