aboutsummaryrefslogtreecommitdiff
path: root/lib/play/testdata
AgeCommit message (Collapse)Author
2026-01-15all: convert license and copyright to use SPDX identifiersShulhan
With help of spdxconv tool [1], we able to bulk update all files license and copyright format to comply with SPDX formats. [1] https://kilabit.info/project/spdxconv/
2025-01-16lib/play: handle writing files outside the [GoOptions.Root]Shulhan
Any request to Run or Test Go code that requires writing new files will be joined with the [GoOptions.Root] first. If the final absolute path does not have Root as the prefix it will return an error [os.ErrPermission].
2024-12-28lib/play: simplify running Go codeShulhan
This changes remove the field pid in the struct command that wait for process ID, instead execute cmd with Run directly. In the Run function, use the UnsafeRun to store temporary directory and move the statements that writes go.mod and main.go into the method writes of Request. This remove unnecessary unsafeRun function.
2024-12-28lib/play: implement function to test Go codeShulhan
The Test and HTTPHandleTest functions accept Request with File and Body fields.
2024-12-06lib/play: add custom request to run unsafe directory directlyShulhan
As exceptional, the Run and HTTPHandleRun accept the following request for running program inside custom "go.mod", { "unsafe_run": <path> } The "unsafe_run" define the path to directory relative to HTTP server working directory. Once request accepted it will change the directory into "unsafe_run" first and then run "go run ." directly. Go code that executed inside "unsafe_run" should be not modifiable and safe from mallicious execution.
2024-11-16lib/play: add option to Run with specific Go version and without raceShulhan
The idea is to allow testing Go code on specific Go version. For example, before Go 1.22, the for loop with variable is shared among block statements, which cause every use of that variable is run with the last value.
2024-10-04lib/play: new package for formatting and running Go codeShulhan
Package play provides callable APIs and HTTP handlers to format and run Go code, similar to Go playground, but using HTTP instead of WebSocket.