diff --git a/packages/go/1.16.2/build.sh b/packages/go/1.16.2/build.sh deleted file mode 100755 index 5cf70f9..0000000 --- a/packages/go/1.16.2/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -curl -LO https://golang.org/dl/go1.16.2.linux-amd64.tar.gz -tar -xzf go1.16.2.linux-amd64.tar.gz -rm go1.16.2.linux-amd64.tar.gz - diff --git a/packages/go/1.16.2/environment b/packages/go/1.16.2/environment deleted file mode 100644 index 88299c1..0000000 --- a/packages/go/1.16.2/environment +++ /dev/null @@ -1,2 +0,0 @@ -export PATH=$PWD/go/bin:$PATH -export GOPATH=$PWD/gopath diff --git a/packages/go/1.16.2/metadata.json b/packages/go/1.16.2/metadata.json deleted file mode 100644 index 0144808..0000000 --- a/packages/go/1.16.2/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "go", - "version": "1.16.2", - "aliases": ["go", "golang"] -} diff --git a/packages/go/1.16.2/run b/packages/go/1.16.2/run deleted file mode 100644 index 65c9a4f..0000000 --- a/packages/go/1.16.2/run +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -mv $1 $1.go -#filename=$1.go -filename=*.go -shift -GOCACHE=$PWD go run $filename "$@" diff --git a/packages/go/1.16.2/test.go b/packages/go/1.16.2/test.go deleted file mode 100644 index c06f485..0000000 --- a/packages/go/1.16.2/test.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("OK") -} diff --git a/runtimes/default.nix b/runtimes/default.nix index cad9dd2..807d46d 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -44,4 +44,5 @@ args: { "iverilog" = import ./iverilog.nix args; "ghc-haskell" = import ./ghc-haskell.nix args; "groovy" = import ./groovy.nix args; + "go" = import ./go.nix args; } diff --git a/runtimes/go.nix b/runtimes/go.nix new file mode 100644 index 0000000..d4b12e3 --- /dev/null +++ b/runtimes/go.nix @@ -0,0 +1,38 @@ +{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"; + }) + ]; +} \ No newline at end of file