-
Notifications
You must be signed in to change notification settings - Fork 0
Incr23 24 #13
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
base: main
Are you sure you want to change the base?
Conversation
bambruysk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно дорабоать в части возврата ошибок из grpc
config/config.go
Outdated
|
|
||
| func withGrpcAddress(address string) Option { | ||
| return func(s *Config) { | ||
| if host, port, err := net.SplitHostPort(address); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Слишком большая вложенность - это не go-way. Лучше классическое if err != nil {return}
proto/service.proto
Outdated
|
|
||
| message UpdateMetricResponse { | ||
| MetricMessage metric = 1; | ||
| string error = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше для возвращения ошибки bспользовать библиотеку grpc/status
proto/service.proto
Outdated
|
|
||
| message MetricMessage { | ||
| string name = 1; | ||
| string type = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type лучше задать как enum
proto/service.proto
Outdated
| message MetricMessage { | ||
| string name = 1; | ||
| string type = 2; | ||
| optional uint64 counter = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А здесь явно напрашиввается oneof - тогда и type не нужен
internal/app/client.go
Outdated
| log.Fatal(err) | ||
| } | ||
|
|
||
| defer func(conn *grpc.ClientConn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А зачем его сразу закрывать?
bambruysk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Принято
| var response pb.UpdateMetricResponse | ||
|
|
||
| err := metric.Check() | ||
| if err, ok := err.(validator.ValidationErrors); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А если это не ошибка валидации, а еще какая-то? Нет я догадываются тчо другиз там и нет, но тогда зачем это приведение? Подозрительнгео место
No description provided.