Skip to content

Commit

Permalink
A bit improved is
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Tkachenko committed Nov 11, 2022
1 parent 5b6944e commit 6e53c07
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion examples/greeter/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ func main() {
log.Fatalf("Failed to dial the server. Error: %v\n", err)
}

defer conn.Close()
defer func(conn *grpc.ClientConn) {
_ = conn.Close()
}(conn)

client := api.NewGreeterServiceClient(conn)

Expand Down
2 changes: 1 addition & 1 deletion examples/greeter/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type server struct {
api.UnimplementedGreeterServiceServer
}

func (s *server) SayHello(ctx context.Context, req *api.SayHelloRequest) (*api.SayHelloResponse, error) {
func (s *server) SayHello(_ context.Context, req *api.SayHelloRequest) (*api.SayHelloResponse, error) {
log.Printf("Handling the request. 'SayHello' has been called for '%s'\n", req.Name)

if len(req.Name) == 0 {
Expand Down
4 changes: 3 additions & 1 deletion examples/redis_greeter/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ func main() {
log.Fatalf("Failed to dial the server. Error: %v\n", err)
}

defer conn.Close()
defer func(conn *grpc.ClientConn) {
_ = conn.Close()
}(conn)

client := api.NewGreeterServiceClient(conn)

Expand Down
2 changes: 1 addition & 1 deletion examples/redis_greeter/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type server struct {
api.UnimplementedGreeterServiceServer
}

func (s *server) SayHello(ctx context.Context, req *api.SayHelloRequest) (*api.SayHelloResponse, error) {
func (s *server) SayHello(_ context.Context, req *api.SayHelloRequest) (*api.SayHelloResponse, error) {
log.Printf("Handling the request. 'SayHello' has been called for '%s'\n", req.Name)

if len(req.Name) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion inmemorycache.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s *inMemoryCache) itemOnTop(v *value) {
}
}

func (s *inMemoryCache) Put(key string, val []byte, ttl time.Duration) error {
func (s *inMemoryCache) Put(key string, val []byte, _ time.Duration) error {
if s.capacity < 1 {
return errors.New("There is no possibility for an insertion. The capacity is 0.")
}
Expand Down
3 changes: 2 additions & 1 deletion metafilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type metaFilter struct {
disallowedHeaders map[string]struct{}
}

func (s *metaFilter) Allowed(key string, val []string) bool {
func (s *metaFilter) Allowed(key string, _ []string) bool {
if _, ok := s.disallowedHeaders[key]; ok {
return false
}
Expand All @@ -43,6 +43,7 @@ func (s *metaFilter) Allowed(key string, val []string) bool {
return ok
}

//goland:noinspection ALL
func NewMetaFilter(headers Headers) MetaFilter {
inst := metaFilter{
allowedHeaders: make(map[string]struct{}),
Expand Down

0 comments on commit 6e53c07

Please sign in to comment.