Skip to content

Commit

Permalink
fix: linters
Browse files Browse the repository at this point in the history
  • Loading branch information
LeKovr committed Jul 29, 2023
1 parent 659ffe6 commit 68144fb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
5 changes: 3 additions & 2 deletions cmd/showonce/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,14 @@ func Run(ctx context.Context, exitFunc func(code int)) {
MaxHeaderBytes: 1 << 20,
}

// creating a listener for server
// creating a listener for GRPC server
var listenerPub net.Listener
listenerPub, err = net.Listen("tcp", cfg.ListenGRPC)
if err != nil {
return
}
// creating a listener for server

// creating a listener for HTTP server
var listener net.Listener
listener, err = net.Listen("tcp", cfg.Listen)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions showonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ var errMissingMetadata = status.Errorf(codes.InvalidArgument, "no incoming metad
// PublicServiceImpl - реализация PublicService.
type PublicServiceImpl struct {
gen.UnimplementedPublicServiceServer
Store storage.StorageIface
Store storage.Iface
}

// NewPublicService - создать PublicService.
func NewPublicService(db storage.StorageIface) *PublicServiceImpl {
func NewPublicService(db storage.Iface) *PublicServiceImpl {
return &PublicServiceImpl{Store: db}
}

Expand All @@ -43,11 +43,11 @@ func (service PublicServiceImpl) GetData(_ context.Context, id *gen.ItemId) (*ge
// PrivateServiceImpl - реадизация PrivateService.
type PrivateServiceImpl struct {
gen.UnimplementedPrivateServiceServer
Store storage.StorageIface
Store storage.Iface
}

// NewPrivateService - создать PrivateService.
func NewPrivateService(db storage.StorageIface) *PrivateServiceImpl {
func NewPrivateService(db storage.Iface) *PrivateServiceImpl {
return &PrivateServiceImpl{Store: db}
}

Expand Down
3 changes: 2 additions & 1 deletion storage/cache/cache.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package cache implements cache storage.
package cache

import (
Expand Down Expand Up @@ -35,7 +36,7 @@ var (
ErrDataCorrupted = errors.New("item data was corrupted")
)

// NewStorage returns new Storage object.
// New returns new Storage object.
func New(cfg Config) Storage {
return Storage{
Meta: zcache.New[string, *gen.ItemMeta](cfg.MetaTTL, cfg.CleanupInterval),
Expand Down
6 changes: 3 additions & 3 deletions storage/storage.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// DONT EDIT: Auto generated by ifacemaker

// Package storage hold Iface which all subpackages implements.
package storage

import (
gen "github.com/LeKovr/showonce/zgen/go/proto"
"github.com/oklog/ulid/v2"
)

// StorageIface makes users independant
type StorageIface interface {
// Iface makes users independent from storage implementation.
type Iface interface {
// SetMeta prepares and saves item metadata and secret.
SetMeta(owner string, req *gen.NewItemRequest) (*ulid.ULID, error)
// GetMeta returns item metadata.
Expand All @@ -20,4 +21,3 @@ type StorageIface interface {
// Stats returns global and user's item counters.
Stats(owner string) (*gen.StatsResponse, error)
}

0 comments on commit 68144fb

Please sign in to comment.