executor

package module
v0.0.0-...-16b8aba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LanguageConfigs = map[string]ExecutionConfig{
	"c": {
		Filename:    "main.c",
		BinaryName:  "main",
		CompileCmd:  []string{"gcc", "main.c", "-o", "main"},
		RunCmd:      []string{"/main"},
		UseCompiler: true,
	},
	"cpp": {
		Filename:    "main.cpp",
		BinaryName:  "main",
		CompileCmd:  []string{"g++", "main.cpp", "-o", "main"},
		RunCmd:      []string{"/main"},
		UseCompiler: true,
	},
	"go": {
		Filename:    "main.go",
		BinaryName:  "main",
		CompileCmd:  []string{"go", "build", "-o", "main", "main.go"},
		RunCmd:      []string{"/main"},
		UseCompiler: true,
	},
	"java": {
		Filename:    "Main.java",
		BinaryName:  "Main.class",
		CompileCmd:  []string{"javac", "Main.java"},
		RunCmd:      []string{"java", "Main"},
		UseCompiler: true,
	},
	"python": {
		Filename:    "script.py",
		Interpreter: "python3",
		UseCompiler: false,
	},
}

Functions

func RunCode

func RunCode(code string, config ExecutionConfig) (string, error)

Types

type ExecutionConfig

type ExecutionConfig struct {
	Filename    string
	BinaryName  string
	CompileCmd  []string
	RunCmd      []string
	UseCompiler bool
	Interpreter string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL