diff --git a/Makefile b/Makefile index edb53b2d..262b6517 100644 --- a/Makefile +++ b/Makefile @@ -47,8 +47,8 @@ $(BIN)/protoc-gen-go: PACKAGE=google.golang.org/protobuf/cmd/protoc-gen-go # Generated files -%.pb.go: %.proto | $(PROTOC_GEN_GO) ; $(info $(M) compiling protocol buffers definition…) - $Q $(PROTOC) -I=. --plugin=$(PROTOC_GEN_GO) --go_out=. --go_opt=paths=source_relative $< +flow/%.pb.go: flow/data/schemas/%.proto | $(PROTOC_GEN_GO) ; $(info $(M) compiling protocol buffers definition…) + $Q $(PROTOC) -I=. --plugin=$(PROTOC_GEN_GO) --go_out=. --go_opt=module=$(MODULE) $< web/data: mkdocs.yml $(wildcard docs/*.md docs/assets/*) ; $(info $(M) build documentation) @ ## Build documentation $Q rm -rf web/data diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 545e9c57..aaa0d0f5 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -30,4 +30,4 @@ services: - 8123:8123/tcp - 9000:9000/tcp volumes: - - ./flow/flow-v0.proto:/var/lib/clickhouse/format_schemas/flow-v0.proto:ro + - ./flow/data/schemas:/var/lib/clickhouse/format_schemas:ro diff --git a/flow/flow-0.proto b/flow/data/schemas/flow-0.proto similarity index 100% rename from flow/flow-0.proto rename to flow/data/schemas/flow-0.proto diff --git a/flow/schema.go b/flow/schemas.go similarity index 91% rename from flow/schema.go rename to flow/schemas.go index 95238ad9..b4661df9 100644 --- a/flow/schema.go +++ b/flow/schemas.go @@ -16,13 +16,13 @@ const CurrentSchemaVersion = 0 var ( // VersionedSchemas is a mapping from schema version to protobuf definitions VersionedSchemas map[int]string - //go:embed flow*.proto + //go:embed data/schemas/flow*.proto schemas embed.FS ) func init() { VersionedSchemas = make(map[int]string) - entries, err := schemas.ReadDir(".") + entries, err := schemas.ReadDir("data/schemas") if err != nil { panic(err) } @@ -34,7 +34,7 @@ func init() { if err != nil { panic(err) } - f, err := schemas.Open(entry.Name()) + f, err := schemas.Open(fmt.Sprintf("data/schemas/%s", entry.Name())) if err != nil { panic(err) } diff --git a/flow/schema_test.go b/flow/schemas_test.go similarity index 100% rename from flow/schema_test.go rename to flow/schemas_test.go