piston/runtimes/go.nix

38 lines
704 B
Nix
Raw Permalink Normal View History

2022-02-16 17:10:46 +01:00
{pkgs, piston, ...}:
let
pkg = pkgs.go;
in piston.mkRuntime {
language = "go";
version = pkg.version;
aliases = [
"golang"
];
run = ''
mv $1 $1.go
filename=*.go
shift
GOCACHE=$PWD ${pkg}/bin/go run $filename "$@"
'';
tests = [
(piston.mkTest {
files = {
"test.go" = ''
package main
import "fmt"
func main() {
fmt.Println("OK")
}
'';
};
args = [];
stdin = "";
packages = [];
main = "test.go";
})
];
}