diff --git a/modules/compiler/compiler.go b/modules/compiler/compiler.go index 7f272a5887eb21590541a6e57855e3f0948af76d..73a7dc823ed984d69f153d3c37af01b032390d74 100644 --- a/modules/compiler/compiler.go +++ b/modules/compiler/compiler.go @@ -28,7 +28,7 @@ const ( ) // TODO: I want to make an interface for a compilable language, so that we can add more languages in the future -// TODO: The cmd might also be an interface or a struct, so that it can build itself based on the OS and language +// TODO: The cmd might also be an interface or a struct, so that it can build itself based on the platform and language // TODO: A cleanup and panic might be needed in setup because if it panics the temp folders should be removed // TODO: I am not sure that the setup should panic, maybe it should return an error instead so its easier to clean up @@ -126,14 +126,14 @@ func InitCompiler(OS OS, language Language, sourceCode string, filename string, } func getOsPrefix(OS OS) string { - // Set the cmd prefix based on the OS + // Set the cmd prefix based on the platform switch OS { case Windows: return "cmd /c " case Linux, MacOS: return "" default: - panic("Unsupported OS") + panic("Unsupported platform") } } diff --git a/modules/compiler/go-compiler/go_compiler.go b/modules/compiler/go-compiler/go_compiler.go index 8a03ee545e63f64200ab8e4b38f8e474faf29cea..e5b4d4fe6b71444b340102978581f287a346b0bc 100644 --- a/modules/compiler/go-compiler/go_compiler.go +++ b/modules/compiler/go-compiler/go_compiler.go @@ -9,7 +9,7 @@ import ( // The function does not produce any executables, since they are deleted after the function ends. func CompileStringToGo(code string, filename string, dependencies ...string) (string, error) { - // Get the OS + // Get the platform OS := runtime.GOOS // SetupEnvironment diff --git a/modules/compiler/rust-compiler/rust_compiler.go b/modules/compiler/rust-compiler/rust_compiler.go index 0d5f46fc4ba7f117d43b87658d2f537968b0faa2..7564fc04628b1f03a1ee9734fccd92c5796d7832 100644 --- a/modules/compiler/rust-compiler/rust_compiler.go +++ b/modules/compiler/rust-compiler/rust_compiler.go @@ -8,7 +8,7 @@ import ( // CompileStringToRust compiles a string of go code to a rust executable func CompileStringToRust(code string, filename string, dependencies ...string) (string, error) { - // Get the OS + // Get the platform OS := runtime.GOOS // SetupEnvironment diff --git a/modules/compiler_v2/data/OS.go b/modules/compiler_v2/platform/platform.go similarity index 85% rename from modules/compiler_v2/data/OS.go rename to modules/compiler_v2/platform/platform.go index ee712afa2147823e95aab4c403b526034729d08a..9d23851bd8365dd15d83021c817db4fabb1a0e91 100644 --- a/modules/compiler_v2/data/OS.go +++ b/modules/compiler_v2/platform/platform.go @@ -1,4 +1,4 @@ -package data +package platform type OS = string diff --git a/modules/compiler_v2/utils/make_command.go b/modules/compiler_v2/utils/make_command.go index 83f0deddfc5c563b12a3e970b82e49fa66ffef8e..52b8c6fa0e80853010d4bc7b9863c1c9b6749147 100644 --- a/modules/compiler_v2/utils/make_command.go +++ b/modules/compiler_v2/utils/make_command.go @@ -1,20 +1,20 @@ package utils import ( - "compiler_V2/data" + p "compiler_V2/platform" "os/exec" "runtime" ) -// MakeCommand creates a command based on the runtime OS +// MakeCommand creates a command based on the runtime platform func MakeCommand(cmd string) *exec.Cmd { - OS := runtime.GOOS - switch OS { - case data.Windows: + platform := runtime.GOOS + switch platform { + case p.Windows: return exec.Command("cmd", "/c", cmd) - case data.Linux, data.MacOS: + case p.Linux, p.MacOS: return exec.Command("bash", "-c", cmd) default: - panic("Unsupported OS") + panic("Unsupported platform") } }