diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index aa5d479..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,20 +0,0 @@ -# Dev guide - -Install `task`: https://taskfile.dev/ - -```bash -# Generate code -task gen - -# Run an example (Should take care of generating code if required) -task example NAME=basic -``` - -A bunch of code lives inside `syncgen` directory. The generated code will be `s2/*.sync.go`. -This is done so we can replicate the comments from proto without copypasta. - -Ensure there is no business logic inside the `syncgen` directory. -Make sure it's just some structures and function declarations. - -* `syncgen/types.sync.tmpl`: Has all the parallel types from `pb/s2.pb.go` -* `syncgen/client.sync.tmpl`: Has all the parallel client method declarations from `pb/s2_grpc.pb.go` \ No newline at end of file diff --git a/Taskfile.yml b/Taskfile.yml index e0b0d0b..ee738a9 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -40,7 +40,7 @@ tasks: - gen cmds: - | - git diff --exit-code pb/*.go s2/*.sync.go && echo "Up-to-date" || { + git diff --exit-code internal/pb/*.go s2/*.sync.go && echo "Up-to-date" || { echo "Not up-to-date" echo "Run task:gen and update the generated code" exit 1 @@ -76,18 +76,18 @@ tasks: sources: - proto/s2/v1alpha/s2.proto generates: - - pb/s2.pb.go - - pb/s2_grpc.pb.go + - internal/pb/s2.pb.go + - internal/pb/s2_grpc.pb.go cmds: - - test -d pb || mkdir pb + - test -d internal/pb || mkdir -p internal/pb - cmd: | protoc --proto_path=proto/s2/v1alpha \ - --go_opt=Ms2.proto=github.com/s2-streamstore/s2-sdk-go/pb \ - --go-grpc_opt=Ms2.proto=github.com/s2-streamstore/s2-sdk-go/pb \ + --go_opt=Ms2.proto=github.com/s2-streamstore/s2-sdk-go/internal/pb \ + --go-grpc_opt=Ms2.proto=github.com/s2-streamstore/s2-sdk-go/internal/pb \ --go_opt=paths=source_relative \ --go-grpc_opt=paths=source_relative \ - --go_out=pb \ - --go-grpc_out=pb \ + --go_out=internal/pb \ + --go-grpc_out=internal/pb \ s2.proto gen:sync: @@ -101,15 +101,15 @@ tasks: - gen:proto sources: - .out/sync-docs - - pb/s2.pb.go - - syncgen/types.sync.tmpl + - internal/pb/s2.pb.go + - s2/types.sync.tmpl generates: - s2/types.sync.go cmds: - cmd: | .out/sync-docs \ - -i pb/s2.pb.go \ - -t syncgen/types.sync.tmpl \ + -i internal/pb/s2.pb.go \ + -t s2/types.sync.tmpl \ -o s2/types.sync.go gen:sync:client: @@ -118,21 +118,21 @@ tasks: - gen:proto sources: - .out/sync-docs - - pb/s2_grpc.pb.go - - syncgen/client.sync.tmpl + - internal/pb/s2_grpc.pb.go + - s2/client.sync.tmpl generates: - s2/client.sync.go cmds: - cmd: | .out/sync-docs \ - -i pb/s2_grpc.pb.go \ - -t syncgen/client.sync.tmpl \ + -i internal/pb/s2_grpc.pb.go \ + -t s2/client.sync.tmpl \ -o s2/client.sync.go gen:sync:_bin: sources: - - cmd/sync-docs/*.go + - internal/sync-docs/*.go generates: - .out/sync-docs cmds: - - go build -o .out/sync-docs ./cmd/sync-docs/*.go + - go build -o .out/sync-docs ./internal/sync-docs/*.go diff --git a/pb/s2.pb.go b/internal/pb/s2.pb.go similarity index 100% rename from pb/s2.pb.go rename to internal/pb/s2.pb.go diff --git a/pb/s2_grpc.pb.go b/internal/pb/s2_grpc.pb.go similarity index 100% rename from pb/s2_grpc.pb.go rename to internal/pb/s2_grpc.pb.go diff --git a/cmd/sync-docs/main.go b/internal/sync-docs/main.go similarity index 100% rename from cmd/sync-docs/main.go rename to internal/sync-docs/main.go diff --git a/s2/account_service_requests.go b/s2/account_service_requests.go index 0f2454f..f99de5f 100644 --- a/s2/account_service_requests.go +++ b/s2/account_service_requests.go @@ -4,7 +4,7 @@ import ( "context" "github.com/google/uuid" - "github.com/s2-streamstore/s2-sdk-go/pb" + "github.com/s2-streamstore/s2-sdk-go/internal/pb" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/fieldmaskpb" diff --git a/s2/basin_service_requests.go b/s2/basin_service_requests.go index 88a39e2..bb65ac8 100644 --- a/s2/basin_service_requests.go +++ b/s2/basin_service_requests.go @@ -4,7 +4,7 @@ import ( "context" "github.com/google/uuid" - "github.com/s2-streamstore/s2-sdk-go/pb" + "github.com/s2-streamstore/s2-sdk-go/internal/pb" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/fieldmaskpb" diff --git a/s2/client.go b/s2/client.go index acc7749..340095f 100644 --- a/s2/client.go +++ b/s2/client.go @@ -10,7 +10,7 @@ import ( "time" "github.com/google/uuid" - "github.com/s2-streamstore/s2-sdk-go/pb" + "github.com/s2-streamstore/s2-sdk-go/internal/pb" "google.golang.org/grpc" "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" diff --git a/syncgen/client.sync.tmpl b/s2/client.sync.tmpl similarity index 100% rename from syncgen/client.sync.tmpl rename to s2/client.sync.tmpl diff --git a/s2/stream_service_requests.go b/s2/stream_service_requests.go index 83d2b6f..e8b434c 100644 --- a/s2/stream_service_requests.go +++ b/s2/stream_service_requests.go @@ -3,7 +3,7 @@ package s2 import ( "context" - "github.com/s2-streamstore/s2-sdk-go/pb" + "github.com/s2-streamstore/s2-sdk-go/internal/pb" ) type checkTailServiceRequest struct { diff --git a/s2/types.go b/s2/types.go index 0f79f98..3363fb8 100644 --- a/s2/types.go +++ b/s2/types.go @@ -7,7 +7,7 @@ import ( "math/rand/v2" "time" - "github.com/s2-streamstore/s2-sdk-go/pb" + "github.com/s2-streamstore/s2-sdk-go/internal/pb" ) const ( diff --git a/syncgen/types.sync.tmpl b/s2/types.sync.tmpl similarity index 100% rename from syncgen/types.sync.tmpl rename to s2/types.sync.tmpl