├── Makefile ├── README.md ├── go-fast-build └── go-fast-compile /Makefile: -------------------------------------------------------------------------------- 1 | install: 2 | cp go-fast-compile /usr/bin/go-fast-compile 3 | cp go-fast-build /usr/bin/go-fast-build 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # go-fast 2 | 3 | Binary snippets for fast compilation Go projects that will increase your free 4 | time in **5x times**. 5 | 6 | ## go-fast-compile 7 | 8 | Just compile your project without linking. This binary is suitable only for 9 | on-save hooks in your favorite editor. 10 | 11 | ## go-fast-build 12 | 13 | Build project only if source code has been changed. This binary is suitable for 14 | daily usage, it's must have binary for integration tests that run on save. 15 | 16 | # Efficiency 17 | 18 | ```bash 19 | for x in `seq 1 20`; do time go build; done 2>&1 | awk '{ x += sprintf("%f", $9); } END { printf x/NR; }' 20 | for x in `seq 1 20`; do time go-fast-compile; done 2>&1 | awk '{ x += sprintf("%f", $8); } END { printf x/NR; }' 21 | ``` 22 | 23 | | project | go build | go-fast-compile | profit | 24 | | --------- | ----------| --------------- | ------ | 25 | | [orgalorg, 2789 lines](https://github.com/reconquest/orgalorg) | `2.343` |`0.826` | **3x faster** | 26 | | [shadowc, 960 lines](https://github.com/reconquest/shadowc) | `2.011` |`0.456` | **5x faster** | 27 | | [manul, 502 lines](https://github.com/kovetskiy/manul) | `1.558` |`0.267` | **7x faster** | 28 | 29 | ## Installation 30 | 31 | **Arch Linux** (god bless you) users can install package **go-fast** from AUR: 32 | 33 | [https://aur.archlinux.org/packages/go-fast/](https://aur.archlinux.org/packages/go-fast/) 34 | 35 | other distros: 36 | 37 | ```bash 38 | $ git clone https://github.com/kovetskiy/go-fast 39 | $ cd go-fast 40 | $ sudo make install 41 | ``` 42 | 43 | ## Usage 44 | 45 | Of course go-fast's stuff works as *go build* binary and all passed variables 46 | will be passed to Go. 47 | -------------------------------------------------------------------------------- /go-fast-build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | export GOBIN=$(pwd) 6 | 7 | exec go install -gcflags "-trimpath $GOPATH/src" "$@" 8 | -------------------------------------------------------------------------------- /go-fast-compile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export WORK="/tmp/go-fast-compile$(pwd | sed "s|^$GOPATH/src||")" 4 | export GOBIN="$WORK" 5 | export GOTOOLDIR=$(go env GOTOOLDIR) 6 | 7 | goinstall="$(go install -x -n "$@" 2>&1)" 8 | if [[ $? -ne 0 ]]; then 9 | echo "$goinstall" 10 | exit 1 11 | fi 12 | 13 | eval "$( 14 | echo "$goinstall" \ 15 | | grep -vP '^(${GOTOOLDIR}/link|mv) ' \ 16 | | sed -r '/^CGO_LDFLAGS=/s/" "/ /g' 17 | )" 18 | 19 | --------------------------------------------------------------------------------