Skip to content

Commit 3452401

Browse files
committed
CI: enable protolint to check proto files
Signed-off-by: Oleksandr Redko <[email protected]>
1 parent 7b0f569 commit 3452401

File tree

5 files changed

+58
-41
lines changed

5 files changed

+58
-41
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ jobs:
6666
run: go install github.com/containerd/[email protected]
6767
- name: Check license boilerplates
6868
run: ltag -t ./hack/ltag --check -v
69+
- name: Install protolint
70+
run: go install github.com/yoheimuta/protolint/cmd/[email protected]
71+
- name: Check protobuf files
72+
run: protolint .
6973

7074
lint-go:
7175
name: "Lint Go"

.protolint.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This is the configuration for protolint.
2+
# See https://github.com/yoheimuta/protolint/blob/v0.55.6/_example/config/.protolint.yaml for details.
3+
---
4+
lint:
5+
rules:
6+
# Enable all default rules.
7+
no_default: false
8+
rules_option:
9+
# MAX_LINE_LENGTH rule option.
10+
max_line_length:
11+
max_chars: 100

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ lint: check-generated
514514
find . -name '*.sh' ! -path "./.git/*" | xargs shfmt -s -d
515515
go-licenses check --include_tests ./... --allowed_licenses=$$(cat ./hack/allowed-licenses.txt)
516516
ltag -t ./hack/ltag --check -v
517+
protolint .
517518

518519
.PHONY: clean
519520
clean:

pkg/driver/external/driver.proto

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
11
syntax = "proto3";
22

3-
option go_package = "github.com/lima-vm/lima/pkg/driver/external";
4-
53
import "google/protobuf/empty.proto";
64

5+
option go_package = "github.com/lima-vm/lima/pkg/driver/external";
6+
77
service Driver {
8-
rpc Validate(google.protobuf.Empty) returns (google.protobuf.Empty);
9-
rpc Initialize(google.protobuf.Empty) returns (google.protobuf.Empty);
10-
rpc CreateDisk(google.protobuf.Empty) returns (google.protobuf.Empty);
11-
rpc Start(google.protobuf.Empty) returns (stream StartResponse);
12-
rpc Stop(google.protobuf.Empty) returns (google.protobuf.Empty);
8+
rpc Validate(google.protobuf.Empty) returns (google.protobuf.Empty);
9+
rpc Initialize(google.protobuf.Empty) returns (google.protobuf.Empty);
10+
rpc CreateDisk(google.protobuf.Empty) returns (google.protobuf.Empty);
11+
rpc Start(google.protobuf.Empty) returns (stream StartResponse);
12+
rpc Stop(google.protobuf.Empty) returns (google.protobuf.Empty);
1313

14-
rpc RunGUI(google.protobuf.Empty) returns (google.protobuf.Empty);
15-
rpc ChangeDisplayPassword(ChangeDisplayPasswordRequest) returns (google.protobuf.Empty);
16-
rpc GetDisplayConnection(google.protobuf.Empty) returns (GetDisplayConnectionResponse);
14+
rpc RunGUI(google.protobuf.Empty) returns (google.protobuf.Empty);
15+
rpc ChangeDisplayPassword(ChangeDisplayPasswordRequest) returns (google.protobuf.Empty);
16+
rpc GetDisplayConnection(google.protobuf.Empty) returns (GetDisplayConnectionResponse);
1717

18-
rpc CreateSnapshot(CreateSnapshotRequest) returns (google.protobuf.Empty);
19-
rpc ApplySnapshot(ApplySnapshotRequest) returns (google.protobuf.Empty);
20-
rpc DeleteSnapshot(DeleteSnapshotRequest) returns (google.protobuf.Empty);
21-
rpc ListSnapshots(google.protobuf.Empty) returns (ListSnapshotsResponse);
18+
rpc CreateSnapshot(CreateSnapshotRequest) returns (google.protobuf.Empty);
19+
rpc ApplySnapshot(ApplySnapshotRequest) returns (google.protobuf.Empty);
20+
rpc DeleteSnapshot(DeleteSnapshotRequest) returns (google.protobuf.Empty);
21+
rpc ListSnapshots(google.protobuf.Empty) returns (ListSnapshotsResponse);
2222

23-
rpc Register(google.protobuf.Empty) returns (google.protobuf.Empty);
24-
rpc Unregister(google.protobuf.Empty) returns (google.protobuf.Empty);
23+
rpc Register(google.protobuf.Empty) returns (google.protobuf.Empty);
24+
rpc Unregister(google.protobuf.Empty) returns (google.protobuf.Empty);
2525

26-
rpc ForwardGuestAgent(google.protobuf.Empty) returns (ForwardGuestAgentResponse);
27-
rpc GuestAgentConn(google.protobuf.Empty) returns (google.protobuf.Empty);
26+
rpc ForwardGuestAgent(google.protobuf.Empty) returns (ForwardGuestAgentResponse);
27+
rpc GuestAgentConn(google.protobuf.Empty) returns (google.protobuf.Empty);
2828

29-
rpc SetConfig(SetConfigRequest) returns (google.protobuf.Empty);
29+
rpc SetConfig(SetConfigRequest) returns (google.protobuf.Empty);
3030

31-
rpc GetInfo(google.protobuf.Empty) returns (InfoResponse);
31+
rpc GetInfo(google.protobuf.Empty) returns (InfoResponse);
3232
}
3333

3434
message InfoResponse{
35-
bytes info_json = 1;
35+
bytes info_json = 1;
3636
}
3737

3838
message StartResponse {
39-
bool success = 1;
40-
string error = 2;
39+
bool success = 1;
40+
string error = 2;
4141
}
4242

4343
message SetConfigRequest {
44-
bytes instance_config_json = 1;
45-
int64 ssh_local_port = 3;
44+
bytes instance_config_json = 1;
45+
int64 ssh_local_port = 3;
4646
}
4747

4848
message ChangeDisplayPasswordRequest {
49-
string password = 1;
49+
string password = 1;
5050
}
5151

5252
message GetDisplayConnectionResponse {
53-
string connection = 1;
53+
string connection = 1;
5454
}
5555

5656
message CreateSnapshotRequest {
57-
string tag = 1;
57+
string tag = 1;
5858
}
5959

6060
message ApplySnapshotRequest {
61-
string tag = 1;
61+
string tag = 1;
6262
}
6363

6464
message DeleteSnapshotRequest {
65-
string tag = 1;
65+
string tag = 1;
6666
}
6767

6868
message ListSnapshotsResponse {
69-
string snapshots = 1;
69+
string snapshots = 1;
7070
}
7171

7272
message ForwardGuestAgentResponse {
73-
bool should_forward = 1;
74-
}
73+
bool should_forward = 1;
74+
}

pkg/guestagent/api/guestservice.proto

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
syntax = "proto3";
2-
option go_package = "github.com/lima-vm/lima/pkg/api";
32

43
import "google/protobuf/empty.proto";
54
import "google/protobuf/timestamp.proto";
65

6+
option go_package = "github.com/lima-vm/lima/pkg/api";
7+
78
service GuestService {
89
rpc GetInfo(google.protobuf.Empty) returns (Info);
910
rpc GetEvents(google.protobuf.Empty) returns (stream Event);
1011
rpc PostInotify(stream Inotify) returns (google.protobuf.Empty);
11-
12+
1213
rpc Tunnel(stream TunnelMessage) returns (stream TunnelMessage);
1314
}
1415

@@ -18,13 +19,13 @@ message Info {
1819

1920
message Event {
2021
google.protobuf.Timestamp time = 1;
21-
repeated IPPort local_ports_added = 2;
22-
repeated IPPort local_ports_removed = 3;
22+
repeated IPPort local_ports_added = 2; //protolint:disable:this REPEATED_FIELD_NAMES_PLURALIZED
23+
repeated IPPort local_ports_removed = 3; //protolint:disable:this REPEATED_FIELD_NAMES_PLURALIZED
2324
repeated string errors = 4;
2425
}
2526

2627
message IPPort {
27-
string protocol = 1; //tcp, udp
28+
string protocol = 1; // tcp, udp
2829
string ip = 2;
2930
int32 port = 3;
3031
}
@@ -36,8 +37,8 @@ message Inotify {
3637

3738
message TunnelMessage {
3839
string id = 1;
39-
string protocol = 2; //tcp, udp
40+
string protocol = 2; // tcp, udp
4041
bytes data = 3;
41-
string guestAddr = 4;
42-
string udpTargetAddr = 5;
42+
string guestAddr = 4; //protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE
43+
string udpTargetAddr = 5; //protolint:disable:this FIELD_NAMES_LOWER_SNAKE_CASE
4344
}

0 commit comments

Comments
 (0)