Skip to content

Commit 7b8ad7b

Browse files
committed
[PLUTO-1431] Go/gosec installation
1 parent b14e5a3 commit 7b8ad7b

File tree

5 files changed

+56
-0
lines changed

5 files changed

+56
-0
lines changed

.codacy/codacy.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ runtimes:
22
33
44
5+
56
67
tools:
78
9+
810
911
1012

config/tools-installer.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ func installRuntimeTool(name string, toolInfo *plugins.ToolInfo, registry string
167167
// Execute the installation command using the package manager
168168
cmd := exec.Command(packageManagerBinary, strings.Split(installCmd, " ")...)
169169

170+
// Special handling for Go tools: set GOBIN so the binary is installed in the tool's install directory
171+
if toolInfo.Runtime == "go" {
172+
env := os.Environ()
173+
env = append(env, "GOBIN="+toolInfo.InstallDir)
174+
cmd.Env = env
175+
}
176+
170177
// Special handling for ESLint installation in Linux (WSL) environment
171178
if toolInfo.Name == "eslint" && runtime.GOOS == "linux" {
172179
// Get node binary directory to add to PATH

plugins/runtime-utils.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ func processRuntime(config RuntimeConfig, runtimesDir string) (*RuntimeInfo, err
5353
var installDir string
5454
if config.Name == "python" {
5555
installDir = path.Join(runtimesDir, "python")
56+
} else if config.Name == "go" {
57+
installDir = path.Join(runtimesDir, "go")
5658
} else {
5759
installDir = path.Join(runtimesDir, fileName)
5860
}

plugins/runtimes/go/plugin.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: go
2+
# Go Programming Language Runtime
3+
# Provides the Go compiler and tools for building and running Go programs.
4+
description: Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
5+
default_version: 1.22.3
6+
download:
7+
url_template: "https://go.dev/dl/go{{.Version}}.{{.OS}}-{{.Arch}}.tar.gz"
8+
file_name_template: "go{{.Version}}.{{.OS}}-{{.Arch}}.tar.gz"
9+
extension:
10+
default: tar.gz
11+
windows: zip
12+
arch_mapping:
13+
amd64: amd64
14+
arm64: arm64
15+
386: 386
16+
arm: armv6l
17+
os_mapping:
18+
linux: linux
19+
darwin: darwin
20+
windows: windows
21+
binaries:
22+
- name: go
23+
path: bin/go
24+
- name: gofmt
25+
path: bin/gofmt

plugins/tools/gosec/plugin.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: gosec
2+
# Gosec - Golang Security Checker
3+
# Inspects source code for security problems by scanning the Go AST.
4+
description: Gosec inspects Go source code for security problems by scanning the Go AST.
5+
default_version: 2.15.0
6+
runtime: go
7+
runtime_binaries:
8+
package_manager: go
9+
execution: go
10+
installation:
11+
command: "install github.com/securego/gosec/v2/cmd/gosec@v{{.Version}}"
12+
binaries:
13+
- name: gosec
14+
path: gosec
15+
formatters: []
16+
output_options:
17+
file_flag: "-out"
18+
analysis_options:
19+
autofix_flag: ""
20+
default_path: "."

0 commit comments

Comments
 (0)