Skip to content

Commit

Permalink
lint: add protolint config
Browse files Browse the repository at this point in the history
And tidy up the proto definitions to follow the new linting rules.

Signed-off-by: Justin Chadwell <[email protected]>
  • Loading branch information
jedevc committed Aug 10, 2023
1 parent cab7db2 commit c540262
Show file tree
Hide file tree
Showing 10 changed files with 339 additions and 316 deletions.
27 changes: 27 additions & 0 deletions .protolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
lint:
directories:
exclude:
- vendor

rules:
no_default: true

add:
# syntax
- INDENT
- SYNTAX_CONSISTENT
- QUOTE_CONSISTENT

# ordering
- IMPORTS_SORTED

# naming
- PACKAGE_NAME_LOWER_CASE
- RPC_NAMES_UPPER_CAMEL_CASE
- RPC_NAMES_CASE
- SERVICE_NAMES_UPPER_CAMEL_CASE

rules_option:
indent:
style: tab
not_insert_newline: true
270 changes: 135 additions & 135 deletions api/services/control/control.pb.go

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions api/services/control/control.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ syntax = "proto3";

package moby.buildkit.v1;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "github.com/moby/buildkit/solver/pb/ops.proto";
import "github.com/moby/buildkit/api/types/worker.proto";
// import "github.com/containerd/containerd/api/types/descriptor.proto";
import "github.com/gogo/googleapis/google/rpc/status.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/moby/buildkit/api/types/worker.proto";
import "github.com/moby/buildkit/solver/pb/ops.proto";
import "github.com/moby/buildkit/sourcepolicy/pb/policy.proto";
import "google/protobuf/timestamp.proto";

option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
Expand Down
297 changes: 148 additions & 149 deletions frontend/gateway/pb/gateway.pb.go

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions frontend/gateway/pb/gateway.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ syntax = "proto3";

package moby.buildkit.v1.frontend;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/gogo/googleapis/google/rpc/status.proto";
import "github.com/moby/buildkit/solver/pb/ops.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/moby/buildkit/api/types/worker.proto";
import "github.com/moby/buildkit/solver/pb/ops.proto";
import "github.com/moby/buildkit/sourcepolicy/pb/policy.proto";
import "github.com/moby/buildkit/util/apicaps/pb/caps.proto";
import "github.com/tonistiigi/fsutil/types/stat.proto";
import "github.com/moby/buildkit/sourcepolicy/pb/policy.proto";



option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
Expand Down Expand Up @@ -70,7 +68,7 @@ message RefMap {
}

message Attestations {
repeated Attestation attestation = 1;
repeated Attestation attestation = 1;
}

message Attestation {
Expand Down Expand Up @@ -167,7 +165,7 @@ message SolveResponse {
// deprecated
string ref = 1; // can be used by readfile request
// deprecated
/* bytes ExporterAttr = 2;*/
// bytes ExporterAttr = 2;

// these fields are returned when allowMapReturn was set
Result result = 3;
Expand Down
8 changes: 4 additions & 4 deletions session/auth/auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ package moby.filesync.v1;
option go_package = "auth";

service Auth{
rpc Credentials(CredentialsRequest) returns (CredentialsResponse);
rpc FetchToken(FetchTokenRequest) returns (FetchTokenResponse);
rpc GetTokenAuthority(GetTokenAuthorityRequest) returns (GetTokenAuthorityResponse);
rpc VerifyTokenAuthority(VerifyTokenAuthorityRequest) returns (VerifyTokenAuthorityResponse);
rpc Credentials(CredentialsRequest) returns (CredentialsResponse);
rpc FetchToken(FetchTokenRequest) returns (FetchTokenResponse);
rpc GetTokenAuthority(GetTokenAuthorityRequest) returns (GetTokenAuthorityResponse);
rpc VerifyTokenAuthority(VerifyTokenAuthorityRequest) returns (VerifyTokenAuthorityResponse);
}

message CredentialsRequest {
Expand Down
7 changes: 3 additions & 4 deletions session/filesync/filesync.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ option go_package = "filesync";
import "github.com/tonistiigi/fsutil/types/wire.proto";

service FileSync{
rpc DiffCopy(stream fsutil.types.Packet) returns (stream fsutil.types.Packet);
rpc TarStream(stream fsutil.types.Packet) returns (stream fsutil.types.Packet);
rpc DiffCopy(stream fsutil.types.Packet) returns (stream fsutil.types.Packet);
rpc TarStream(stream fsutil.types.Packet) returns (stream fsutil.types.Packet);
}

service FileSend{
rpc DiffCopy(stream BytesMessage) returns (stream BytesMessage);
rpc DiffCopy(stream BytesMessage) returns (stream BytesMessage);
}


// BytesMessage contains a chunk of byte data
message BytesMessage{
bytes data = 1;
Expand Down
2 changes: 1 addition & 1 deletion session/secrets/secrets.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package moby.buildkit.secrets.v1;
option go_package = "secrets";

service Secrets{
rpc GetSecret(GetSecretRequest) returns (GetSecretResponse);
rpc GetSecret(GetSecretRequest) returns (GetSecretResponse);
}


Expand Down
8 changes: 4 additions & 4 deletions solver/pb/ops.proto
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,14 @@ message MergeOp {
}

message LowerDiffInput {
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
}

message UpperDiffInput {
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
}

message DiffOp {
LowerDiffInput lower = 1;
UpperDiffInput upper = 2;
LowerDiffInput lower = 1;
UpperDiffInput upper = 2;
}
16 changes: 8 additions & 8 deletions util/stack/stack.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ syntax = "proto3";
package stack;

message Stack {
repeated Frame frames = 1;
repeated string cmdline = 2;
int32 pid = 3;
string version = 4;
string revision = 5;
repeated Frame frames = 1;
repeated string cmdline = 2;
int32 pid = 3;
string version = 4;
string revision = 5;
}

message Frame {
string Name = 1;
string File = 2;
int32 Line = 3;
string Name = 1;
string File = 2;
int32 Line = 3;
}

0 comments on commit c540262

Please sign in to comment.