mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2025-12-12 22:11:15 +00:00
chore: update implementation
This commit is contained in:
parent
f0048dcd91
commit
559cee9521
2 changed files with 12 additions and 13 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import * as core from "@actions/core"
|
||||
import * as tc from "@actions/tool-cache"
|
||||
import { exec, ExecOptions } from "child_process"
|
||||
import { exec, ExecOptionsWithStringEncoding } from "child_process"
|
||||
import os from "os"
|
||||
import path from "path"
|
||||
import { promisify } from "util"
|
||||
|
|
@ -82,7 +82,7 @@ async function goInstall(versionInfo: VersionInfo): Promise<string> {
|
|||
|
||||
const startedAt = Date.now()
|
||||
|
||||
const options: ExecOptions = { env: { ...process.env, CGO_ENABLED: "1" } }
|
||||
const options: ExecOptionsWithStringEncoding = { env: { ...process.env, CGO_ENABLED: "1" } }
|
||||
|
||||
const exres = await execShellCommand(
|
||||
`go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${versionInfo.TargetVersion}`,
|
||||
|
|
@ -160,21 +160,20 @@ function getAssetURL(versionInfo: VersionInfo): string {
|
|||
break
|
||||
}
|
||||
|
||||
let arch = os.arch()
|
||||
switch (arch) {
|
||||
let platformArch = "amd64"
|
||||
switch (os.arch()) {
|
||||
case "arm64":
|
||||
arch = "arm64"
|
||||
platformArch = "arm64"
|
||||
break
|
||||
case "x64":
|
||||
arch = "amd64"
|
||||
platformArch = "amd64"
|
||||
break
|
||||
case "x32":
|
||||
case "ia32":
|
||||
arch = "386"
|
||||
platformArch = "386"
|
||||
break
|
||||
}
|
||||
|
||||
const noPrefix = versionInfo.TargetVersion.slice(1)
|
||||
|
||||
return `https://github.com/golangci/golangci-lint/releases/download/${versionInfo.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${arch}.${ext}`
|
||||
return `https://github.com/golangci/golangci-lint/releases/download/${versionInfo.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${platformArch}.${ext}`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as core from "@actions/core"
|
||||
import * as github from "@actions/github"
|
||||
import { exec, ExecOptions } from "child_process"
|
||||
import { exec, ExecOptionsWithStringEncoding } from "child_process"
|
||||
import * as fs from "fs"
|
||||
import * as path from "path"
|
||||
import { promisify } from "util"
|
||||
|
|
@ -116,7 +116,7 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
const cmdArgs: ExecOptions = {}
|
||||
const cmdArgs: ExecOptionsWithStringEncoding = {}
|
||||
|
||||
const workingDirectory = core.getInput(`working-directory`)
|
||||
if (workingDirectory) {
|
||||
|
|
@ -156,7 +156,7 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
|
|||
core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`)
|
||||
}
|
||||
|
||||
async function runVerify(binPath: string, userArgsMap: Map<string, string>, cmdArgs: ExecOptions): Promise<void> {
|
||||
async function runVerify(binPath: string, userArgsMap: Map<string, string>, cmdArgs: ExecOptionsWithStringEncoding): Promise<void> {
|
||||
const verify = core.getBooleanInput(`verify`, { required: true })
|
||||
if (!verify) {
|
||||
return
|
||||
|
|
@ -178,7 +178,7 @@ async function runVerify(binPath: string, userArgsMap: Map<string, string>, cmdA
|
|||
printOutput(res)
|
||||
}
|
||||
|
||||
async function getConfigPath(binPath: string, userArgsMap: Map<string, string>, cmdArgs: ExecOptions): Promise<string> {
|
||||
async function getConfigPath(binPath: string, userArgsMap: Map<string, string>, cmdArgs: ExecOptionsWithStringEncoding): Promise<string> {
|
||||
let cmdConfigPath = `${binPath} config path`
|
||||
if (userArgsMap.get("config")) {
|
||||
cmdConfigPath += ` --config=${userArgsMap.get("config")}`
|
||||
|
|
|
|||
Loading…
Reference in a new issue