diff options
author | Vincent Ambo <mail@tazj.in> | 2020-06-18T01·29+0100 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2020-06-18T01·29+0100 |
commit | e1e1764e323e220c800d3ab1d43da12745a9b86b (patch) | |
tree | cec059fdf21dd16a84993e985282ef5e3a4443d7 /nix/buildTypedGo/example | |
parent | 22821b886bdb161fa6222caa3a77d3e3872a0640 (diff) |
feat(nix/buildTypedGo): Add a //nix/buildGo wrapper for typed Go r/1017
These functions work like buildGo.program & buildGo.package, but run the .go2 sources through go2go first before passing them to the //nix/buildGo equivalents. Change-Id: Id1ebab6085c390d6986387370181377b9f5d39e8
Diffstat (limited to 'nix/buildTypedGo/example')
-rw-r--r-- | nix/buildTypedGo/example/default.nix | 8 | ||||
-rw-r--r-- | nix/buildTypedGo/example/main.go2 | 15 |
2 files changed, 23 insertions, 0 deletions
diff --git a/nix/buildTypedGo/example/default.nix b/nix/buildTypedGo/example/default.nix new file mode 100644 index 000000000000..5b6d4171f99c --- /dev/null +++ b/nix/buildTypedGo/example/default.nix @@ -0,0 +1,8 @@ +{ depot, ... }: + +depot.nix.buildTypedGo.program { + name = "example"; + srcs = [ + ./main.go2 + ]; +} diff --git a/nix/buildTypedGo/example/main.go2 b/nix/buildTypedGo/example/main.go2 new file mode 100644 index 000000000000..8986f57b94c7 --- /dev/null +++ b/nix/buildTypedGo/example/main.go2 @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" +) + +func Print(type T)(s []T) { + for _, v := range s { + fmt.Print(v) + } +} + +func main() { + Print([]string{"Hello, ", "TVL\n"}) +} |