Skip to content
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

add go baseline for generate #10

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:1.18-bullseye",
"features": {
"ghcr.io/brokeyourbike/devcontainer-features/mockery-go:0": {
"version": "2.20.2"
},
"ghcr.io/devcontainers-contrib/features/protoc:1": {
"version": "3.20.3"
}
},
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
"customizations": {
"vscode": {
"extensions": [
"golang.go"
]
}
}

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
5 changes: 5 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
go mod download
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install golang.org/x/tools/cmd/stringer@latest
export PATH="$PATH:$(go env GOPATH)/bin"
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ generate:
mockery --dir=gen/worldserver/pb --output=gen/worldserver/pb/mocks --name=WorldServerServiceClient --structname=WorldServerServiceClient
mockery --dir=gen/mail/pb --output=gen/mail/pb/mocks --name=MailServiceClient --structname=MailServiceClient
mockery --dir=gen/group/pb --output=gen/group/pb/mocks --name=GroupServiceClient --structname=GroupServiceClient
protoc --proto_path=api/proto/v1/characters --go_out=plugins=grpc:. characters.proto
protoc --proto_path=api/proto/v1/servers-registry --go_out=plugins=grpc:. registry.proto
protoc --proto_path=api/proto/v1/chat --go_out=plugins=grpc:. chat.proto
protoc --proto_path=api/proto/v1/guilds --go_out=plugins=grpc:. guilds.proto
protoc --proto_path=api/proto/v1/guid --go_out=plugins=grpc:. guid.proto
protoc --proto_path=api/proto/v1/mail --go_out=plugins=grpc:. mail.proto
protoc --proto_path=api/proto/v1/worldserver --go_out=plugins=grpc:. worldserver.proto
protoc --proto_path=api/proto/v1/group --go_out=plugins=grpc:. group.proto
# Preferred protobuf versions:
# brew install protobuf@3
# go install google.golang.org/protobuf/cmd/[email protected]
# go install google.golang.org/grpc/cmd/[email protected]
protoc --proto_path=api/proto/v1/characters --go-grpc_out=. --go_out=. characters.proto
protoc --proto_path=api/proto/v1/servers-registry --go-grpc_out=. --go_out=. registry.proto
protoc --proto_path=api/proto/v1/chat --go-grpc_out=. --go_out=. chat.proto
protoc --proto_path=api/proto/v1/guilds --go-grpc_out=. --go_out=. guilds.proto
protoc --proto_path=api/proto/v1/guid --go-grpc_out=. --go_out=. guid.proto
protoc --proto_path=api/proto/v1/mail --go-grpc_out=. --go_out=. mail.proto
protoc --proto_path=api/proto/v1/worldserver --go-grpc_out=. --go_out=. worldserver.proto
protoc --proto_path=api/proto/v1/group --go-grpc_out=. --go_out=. group.proto

migrate-characters:
migrate -database "mysql://trinity:trinity@tcp(localhost:3306)/characters" -path sql/characters/mysql up
Expand Down
1 change: 1 addition & 0 deletions apps/charserver/server/charserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
)

type CharServer struct {
pb.UnimplementedCharactersServiceServer
repo repo.Characters
whoHandler repo.WhoHandler
itemsTemplate repo.ItemsTemplate
Expand Down
1 change: 1 addition & 0 deletions apps/chatserver/server/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

type ChatService struct {
pb.UnimplementedChatServiceServer
charRepo repo.CharactersRepo
}

Expand Down
1 change: 1 addition & 0 deletions apps/groupserver/server/group-logger_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// groupDebugLoggerMiddleware middleware that adds debug logs for pb.GroupServiceServer.
type groupDebugLoggerMiddleware struct {
pb.UnimplementedGroupServiceServer
realServer pb.GroupServiceServer
logger zerolog.Logger
}
Expand Down
1 change: 1 addition & 0 deletions apps/groupserver/server/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

type GroupServer struct {
pb.UnimplementedGroupServiceServer
groupService service.GroupsService
}

Expand Down
1 change: 1 addition & 0 deletions apps/guidserver/server/guids-logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// guidServerLoggerMiddleware is guild server logger.
type guidServerLoggerMiddleware struct {
pb.UnimplementedGuidServiceServer
realService pb.GuidServiceServer
logger zerolog.Logger
}
Expand Down
1 change: 1 addition & 0 deletions apps/guidserver/server/guids.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

// GuidServer is guild server that handles grpc requests.
type GuidServer struct {
pb.UnimplementedGuidServiceServer
guildsService service.GuidService
}

Expand Down
1 change: 1 addition & 0 deletions apps/guildserver/server/guilds-logger_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// guildDebugLoggerMiddleware middleware that adds debug logs for pb.GuildServiceServer.
type guildDebugLoggerMiddleware struct {
pb.UnimplementedGuildServiceServer
realService pb.GuildServiceServer
logger zerolog.Logger
}
Expand Down
1 change: 1 addition & 0 deletions apps/guildserver/server/guilds.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

// GuildServer is guild server that handles grpc requests.
type GuildServer struct {
pb.UnimplementedGuildServiceServer
guildsService service.GuildService
}

Expand Down
1 change: 1 addition & 0 deletions apps/mailserver/server/mail-logger_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// mailDebugLoggerMiddleware middleware that adds debug logs for pb.MailServiceServer.
type mailDebugLoggerMiddleware struct {
pb.UnimplementedMailServiceServer
mailServer pb.MailServiceServer
logger zerolog.Logger
}
Expand Down
1 change: 1 addition & 0 deletions apps/mailserver/server/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

type MailServer struct {
pb.UnimplementedMailServiceServer
service *service.MailService
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

// serversRegistryDebugLoggerMiddleware middleware that adds debug logs for pb.ServersRegistryServiceServer.
type serversRegistryDebugLoggerMiddleware struct {
pb.UnimplementedServersRegistryServiceServer
realService pb.ServersRegistryServiceServer
logger zerolog.Logger
}
Expand Down
1 change: 1 addition & 0 deletions apps/servers-registry/server/registry-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
const ver = "0.0.1"

type serversRegistry struct {
pb.UnimplementedServersRegistryServiceServer
gService service.GameServer
lbService service.LoadBalancer
}
Expand Down
1 change: 1 addition & 0 deletions game-server/libsidecar/grpcapi/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type RequestQueue struct {
}

type WorldServerGRPCAPI struct {
pb.UnimplementedWorldServerServiceServer
bindings CppBindings
timeout time.Duration
readQueue queue.HandlersQueue
Expand Down
Loading
Loading