Add readme and makefile entry about code generation

This commit is contained in:
Kristoffer Dalby 2021-10-26 20:53:10 +00:00
parent 2f045b20fb
commit b8c89cd63c
2 changed files with 39 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# Calculate version
version = $(shell ./scripts/version-at-commit.sh)
build:
build: generate
go build -ldflags "-s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=$(version)" cmd/headscale/headscale.go
dev: lint test build
@ -25,3 +25,6 @@ lint:
compress: build
upx --brute headscale
generate:
rm -rf gen
buf generate proto

View File

@ -60,6 +60,41 @@ Please have a look at the documentation under [`docs/`](docs/).
1. We have nothing to do with Tailscale, or Tailscale Inc.
2. The purpose of writing this was to learn how Tailscale works.
## Contributing
To contribute to Headscale you would need the lastest version of [Go](golang.org) and [Buf](https://buf.build)(Protobuf generator).
### Install development tools
- Go
- Buf
- Protobuf tools:
```shell
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
```
Building the project requires the generation of Go code from Protobuf (in `proto/`) and it can be (re-)generated with:
```shell
make generate
```
To run the tests:
```shell
make test
```
To build the program:
```shell
make build
```
## Contributors