feat(nix/buildTypedGo): Add a //nix/buildGo wrapper for typed Go
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
This commit is contained in:
parent
22821b886b
commit
e1e1764e32
3 changed files with 56 additions and 0 deletions
8
nix/buildTypedGo/example/default.nix
Normal file
8
nix/buildTypedGo/example/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{ depot, ... }:
|
||||
|
||||
depot.nix.buildTypedGo.program {
|
||||
name = "example";
|
||||
srcs = [
|
||||
./main.go2
|
||||
];
|
||||
}
|
||||
15
nix/buildTypedGo/example/main.go2
Normal file
15
nix/buildTypedGo/example/main.go2
Normal file
|
|
@ -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"})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue