mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 21:07:46 +00:00
[go] Go builder improvements (#9576)
This PR fixes a handful of Go builder issues all related to the selected Golang version being used to build the function: - `go.mod` version ignored for `vc build` and `vc dev`, uses system `PATH` version only - `vc dev` fails if `go.mod` does not exist - If the analyze bin doesn’t exist, downloads golang into `.vercel/cache/golang` instead of a global shared dir - When running `vc dev`, doesn’t reuse go build code/common settings - go tidy fails when `go.mod` set to 1.19 or 1.20, but 1.18 or older is installed - `vc build` builds wrong arch on Apple Silicon/arm64 - `vc build` on Windows doesn't properly resolve "builds" in `vercel.json` due to posix separator issue - `vc build` on Windows fails with `package <pkg/name> is not in GOROOT` due to posix separator issue - Removed `actions/setup-go` from all test workflows I added a test that tests the `go tidy` issue.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import fs from 'fs-extra';
|
||||
import chalk from 'chalk';
|
||||
import dotenv from 'dotenv';
|
||||
import { join, normalize, relative, resolve } from 'path';
|
||||
import { join, normalize, relative, resolve, sep } from 'path';
|
||||
import {
|
||||
getDiscontinuedNodeVersions,
|
||||
normalizePath,
|
||||
@@ -712,7 +712,9 @@ function expandBuild(files: string[], build: Builder): Builder[] {
|
||||
});
|
||||
}
|
||||
|
||||
let src = normalize(build.src || '**');
|
||||
let src = normalize(build.src || '**')
|
||||
.split(sep)
|
||||
.join('/');
|
||||
if (src === '.' || src === './') {
|
||||
throw new NowBuildError({
|
||||
code: `invalid_build_specification`,
|
||||
|
||||
Reference in New Issue
Block a user