github.com/zyedidia/knit@v1.1.2-0.20230901152954-f7d4e39a0e24/examples/go/README.md (about) 1 Knitfile: 2 3 ```lua 4 local flags := -trimpath -ldflags "-s -w" 5 local name := hello 6 7 local systems = { 8 f"$name-linux-amd64", 9 f"$name-linux-386", 10 f"$name-linux-arm", 11 f"$name-linux-arm64", 12 f"$name-darwin-amd64", 13 f"$name-darwin-arm64", 14 f"$name-openbsd-amd64", 15 f"$name-freebsd-amd64", 16 f"$name-windows-amd64", 17 } 18 19 return b{ 20 $ build:VB: $name 21 22 $ $name:B: 23 go build $flags 24 25 $ install:VB: 26 go install $flags 27 28 $ all:V: $systems 29 30 $ ($name-(.*)-(.*)):R: 31 GOOS=$match2 GOARCH=$match3 go build $flags -o $match1 32 33 $ test:VB: 34 go test 35 36 $ cover.out:B: 37 go test -coverprofile cover.out 38 39 $ cover-html:VB: cover.out 40 go tool cover -html=$input 41 42 $ cover:VB: 43 go test -cover 44 45 $ clean:VBQ: 46 knit :all -t clean 47 } 48 ``` 49 50 Targets: 51 52 * `knit build`: build. 53 * `knit install`: install to gopath. 54 * `knit test`: test. 55 * `knit cover`: show test coverage. 56 * `knit cover-html`: open coverage visualizer in browser. 57 * `knit all`: build all cross-compilation targets. 58 59 Graph: 60 61 <img alt="build graph" src="./graph.svg" width="500px"/>