Skip to content
Snippets Groups Projects
Commit ba68246c authored by Aleksander Einarsen's avatar Aleksander Einarsen
Browse files

Added comments

parent 674bfd77
No related branches found
No related tags found
No related merge requests found
......@@ -10,10 +10,18 @@ const fileName = "main.go"
type GoCompiler struct{}
// NewGoCompiler creates a new GoCompiler
func NewGoCompiler() *GoCompiler {
return &GoCompiler{}
}
// CheckCompileErrors takes Go source code and checks for compile errors.
//
// The dependencies are handled automatically by go mod and go tidy.
//
// NOTE: Make sure you have an up-to-date Go installed on the system
//
// Returns the output of the compilation and an error if any
func (gb *GoCompiler) CheckCompileErrors(srcCode []byte) ([]byte, error) {
// Make temp folders
utils.SetupTempFolders(consts.TempOutputDir)
......
package platform
// OS Operating system type
type OS = string
// Platform enums
const (
Windows OS = "windows"
Linux OS = "linux"
......
......@@ -11,10 +11,17 @@ const fileName = "main.rs"
type RustCompiler struct{}
// NewRustCompiler creates a new RustCompiler
func NewRustCompiler() *RustCompiler {
return &RustCompiler{}
}
// CheckCompileErrors takes Rust source code and the dependencies it requires and checks for compile errors.
//
// The dependencies are optional, and should be name only, not version.
// For instance "rand" and not "rand:0.8.3". Cargo will automatically fetch the latest version.
//
// Returns the output of the compilation and an error if any
func (gb *RustCompiler) CheckCompileErrors(srcCode []byte, dependencies ...string) ([]byte, error) {
// Make temp folders
utils.SetupTempFolders(consts.TempOutputDir)
......@@ -45,6 +52,7 @@ func (gb *RustCompiler) CheckCompileErrors(srcCode []byte, dependencies ...strin
return cmd.CombinedOutput()
}
// initCargo initializes a cargo project
func initCargo() error {
// Init cargo
cmd := utils.MakeCommand("cargo init --bin")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment