| Age | Commit message (Collapse) | Author |
|
|
|
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/
|
|
Since Go 1.19, package "encoding/binary.BigEndian" support appending
byte order.
|
|
Using [T.Fatal] on non-test goroutines is not recommended and caught by
go vet.
|
|
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].
|
|
One of the major issue that we previously have is the Run and Test
functions can write file in any unsafe path.
Another issue is changing the default GoVersion and Timeout is set on
the package level.
This changes introduce new type Go as the top level type that can be
instantiate with different Root, GoVersion, and Timeout.
The instance of Go then can Format, Run, or Test the Go code in their
own scope.
|
|
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.
|
|
|
|
The home and cache dir should never changes during a running program,
so we can set in once during package initialization.
If Go failed to get the home and cache it will be set to system temporary
directory.
|
|
The Test and HTTPHandleTest functions accept Request with File and Body
fields.
|
|
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.
|
|
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.
|
|
By exposing the Timeout, user can set their maximum time the program
can run in their playground.
|
|
Package play provides callable APIs and HTTP handlers to format and run
Go code, similar to Go playground, but using HTTP instead of WebSocket.
|