Skip to content

Buf #594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Nov 24, 2021
Merged

Buf #594

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
tap 'filosottile/musl-cross'
tap 'bufbuild/buf'
tap 'goreleaser/tap'

brew 'go'
brew 'cmake'
brew 'pkg-config'
brew 'sqlite'
brew 'protobuf'
brew 'FiloSottile/musl-cross/musl-cross'
brew 'goreleaser/tap/goreleaser'
brew 'musl-cross'
brew 'goreleaser'
brew 'buf'
12 changes: 7 additions & 5 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Before starting, make sure you have the following installed:
- GCC Compiler
- [SQLite](https://sqlite.org/index.html)
- [Go 1.16+](https://golang.org/doc/install)
- [Buf](https://docs.buf.build/introduction)
- [Protoc Compiler](https://github.com/protocolbuffers/protobuf)

## Setup
Expand All @@ -22,7 +23,7 @@ Before starting, make sure you have the following installed:

## Go

Flipt is built with Go 1.16+. To reliably build Flipt, make sure you clone it to a location outside of your `$GOPATH`.
Flipt is built with Go 1.16+.

## Configuration

Expand All @@ -38,10 +39,11 @@ Changing certain types of files such as the protobuf, ui or documentation files

### Updating .proto Files

After changing `flipt.proto`, you'll need to run `make proto`. This will regenerate the following files:
After changing `flipt.proto`, you'll need to run `make generate`. This will regenerate the following files:

- `rpc/flipt.pb.go`
- `rpc/flipt.pb.gw.go`
- `rpc/flipt/flipt.pb.go`
- `rpc/flipt/flipt_grpc.pb.go`
- `rpc/flipt/flipt.pb.gw.go`

### Updating assets

Expand Down Expand Up @@ -69,6 +71,6 @@ Regardless of whether you are using Remote Containers or GitHub Codespaces, you'

Then run the [Server/Client](.vscode/launch.json) run command to start the server and client.

This should publish three ports `8080`, `8081`, `9000`.
This should publish three ports `8080`, `8081`, `9000`.

`8081` is the UI dev port that runs the `yarn dev server` that you can open in your browser.
23 changes: 6 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ $(UI_OUTPUT_PATH): $(UI_NODE_MODULES_PATH) $(UI_SOURCE_FILES)
.PHONY: bootstrap
bootstrap: ## Install dev tools
@echo ">> installing dev tools"
go get -u -v "github.com/golang/protobuf/protoc-gen-go@v1.4.2"
@./script/bootstrap

.PHONY: bench
Expand Down Expand Up @@ -59,24 +58,14 @@ clean: ## Cleanup generated files
rm -rf dist/*
go mod tidy

.PHONY: proto
proto: ## Build protobufs
@echo ">> generating protobufs"
protoc -I/usr/local/include -I. \
-Irpc \
--go_opt=paths=source_relative \
--go_out=./rpc \
--go-grpc_out=./rpc \
--go-grpc_opt=paths=source_relative \
--grpc-gateway_out=logtostderr=true,grpc_api_configuration=./rpc/flipt.yaml:./rpc \
--grpc-gateway_opt=paths=source_relative \
--swagger_out=logtostderr=true,grpc_api_configuration=./rpc/flipt.yaml:./swagger \
$(PROJECT).proto
.PHONY: generate
generate: ## Generate proto/grpc/grpc-gateway stubs and docs
@echo ">> generating"
buf generate

.PHONY: assets
assets: $(UI_OUTPUT_PATH) ## Build the ui


commit-hash=$(shell set -e && git rev-parse --verify HEAD || "")

.PHONY: build
Expand All @@ -87,7 +76,7 @@ build: clean assets ## Build a local copy
.PHONY: server
server: clean ## Build and run in server mode
@echo ">> building and running in server mode"
@echo " ⚠️ ui must be run in another process ⚠️"
@echo " ⚠️ ui must be run in another process ⚠️"
go run ./cmd/$(PROJECT)/. --config ./config/local.yml --force-migrate

.PHONY: snapshot
Expand All @@ -103,7 +92,7 @@ release: clean assets ## Build and publish a release
.PHONY: clients
clients: ## Generate GRPC clients
@echo ">> generating GRPC clients"
@./script/build clients
@buf generate --template=buf.public.gen.yaml

.PHONY: help
help:
Expand Down
26 changes: 6 additions & 20 deletions _tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,12 @@ module tools
go 1.16

require (
github.com/buchanae/github-release-notes v0.0.0-20180827045457-200e1dacadbb // indirect
github.com/go-lintpack/lintpack v0.5.2 // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 // indirect
github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 // indirect
github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d // indirect
github.com/golangci/golangci-lint v1.40.1 // indirect
github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc // indirect
github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 // indirect
github.com/buchanae/github-release-notes v0.0.0-20180827045457-200e1dacadbb
github.com/golangci/golangci-lint v1.40.1
github.com/google/go-github v17.0.0+incompatible // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5 // indirect
github.com/sclevine/agouti v3.0.0+incompatible // indirect
github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada // indirect
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa // indirect
github.com/ugorji/go v1.1.4 // indirect
golang.org/x/tools v0.1.3 // indirect
google.golang.org/grpc v1.38.0 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 // indirect
google.golang.org/protobuf v1.26.0-rc.1 // indirect
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0
golang.org/x/tools v0.1.3
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0
google.golang.org/protobuf v1.27.1
)
Loading