Enable forgejo CI #122

Merged
alexvanin merged 1 commit from alexvanin/frostfs-s3-gw:ci into master 2023-07-26 21:08:01 +00:00
7 changed files with 24 additions and 30 deletions
Showing only changes of commit 81e860481d - Show all commits

View file

@ -790,6 +790,8 @@ const doubleSpace = " "
// stripExcessSpaces will rewrite the passed in slice's string values to not // stripExcessSpaces will rewrite the passed in slice's string values to not
// contain multiple side-by-side spaces. // contain multiple side-by-side spaces.
//
//nolint:revive
dkirillov marked this conversation as resolved
Review

Just wondering why is Revival complaining about this function?

Just wondering why is Revival complaining about this function?
Review

It does not like for loops with empty block, even though they modify j and k variables.

// revive  empty-block: this block is empty, you can remove it
for j = len(str) - 1; j >= 0 && str[j] == ' '; j-- {
}
It does not like for loops with empty block, even though they modify `j` and `k` variables. ```go // revive empty-block: this block is empty, you can remove it for j = len(str) - 1; j >= 0 && str[j] == ' '; j-- { } ```
func stripExcessSpaces(vals []string) { func stripExcessSpaces(vals []string) {
var j, k, l, m, spaces int var j, k, l, m, spaces int
for i, str := range vals { for i, str := range vals {

View file

@ -189,7 +189,7 @@ func (t *TestFrostFS) ReadObject(ctx context.Context, prm PrmObjectRead) (*Objec
return nil, fmt.Errorf("%w: %s", apistatus.ObjectNotFound{}, addr) return nil, fmt.Errorf("%w: %s", apistatus.ObjectNotFound{}, addr)
} }
func (t *TestFrostFS) CreateObject(ctx context.Context, prm PrmObjectCreate) (oid.ID, error) { func (t *TestFrostFS) CreateObject(_ context.Context, prm PrmObjectCreate) (oid.ID, error) {
b := make([]byte, 32) b := make([]byte, 32)
if _, err := io.ReadFull(rand.Reader, b); err != nil { if _, err := io.ReadFull(rand.Reader, b); err != nil {
return oid.ID{}, err return oid.ID{}, err

View file

@ -59,17 +59,17 @@ func (t *TreeServiceMock) DeleteObjectTagging(_ context.Context, bktInfo *data.B
return nil return nil
} }
func (t *TreeServiceMock) GetBucketTagging(ctx context.Context, bktInfo *data.BucketInfo) (map[string]string, error) { func (t *TreeServiceMock) GetBucketTagging(context.Context, *data.BucketInfo) (map[string]string, error) {
// TODO implement me // TODO implement me
panic("implement me") panic("implement me")
} }
func (t *TreeServiceMock) PutBucketTagging(ctx context.Context, bktInfo *data.BucketInfo, tagSet map[string]string) error { func (t *TreeServiceMock) PutBucketTagging(context.Context, *data.BucketInfo, map[string]string) error {
// TODO implement me // TODO implement me
panic("implement me") panic("implement me")
} }
func (t *TreeServiceMock) DeleteBucketTagging(ctx context.Context, bktInfo *data.BucketInfo) error { func (t *TreeServiceMock) DeleteBucketTagging(context.Context, *data.BucketInfo) error {
// TODO implement me // TODO implement me
panic("implement me") panic("implement me")
} }
@ -100,15 +100,15 @@ func (t *TreeServiceMock) GetSettingsNode(_ context.Context, bktInfo *data.Bucke
return settings, nil return settings, nil
} }
func (t *TreeServiceMock) GetNotificationConfigurationNode(ctx context.Context, bktInfo *data.BucketInfo) (oid.ID, error) { func (t *TreeServiceMock) GetNotificationConfigurationNode(context.Context, *data.BucketInfo) (oid.ID, error) {
panic("implement me") panic("implement me")
} }
func (t *TreeServiceMock) PutNotificationConfigurationNode(ctx context.Context, bktInfo *data.BucketInfo, objID oid.ID) (oid.ID, error) { func (t *TreeServiceMock) PutNotificationConfigurationNode(context.Context, *data.BucketInfo, oid.ID) (oid.ID, error) {
panic("implement me") panic("implement me")
} }
func (t *TreeServiceMock) GetBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) (oid.ID, error) { func (t *TreeServiceMock) GetBucketCORS(_ context.Context, bktInfo *data.BucketInfo) (oid.ID, error) {
systemMap, ok := t.system[bktInfo.CID.EncodeToString()] systemMap, ok := t.system[bktInfo.CID.EncodeToString()]
if !ok { if !ok {
return oid.ID{}, nil return oid.ID{}, nil
@ -122,7 +122,7 @@ func (t *TreeServiceMock) GetBucketCORS(ctx context.Context, bktInfo *data.Bucke
return node.OID, nil return node.OID, nil
} }
func (t *TreeServiceMock) PutBucketCORS(ctx context.Context, bktInfo *data.BucketInfo, objID oid.ID) (oid.ID, error) { func (t *TreeServiceMock) PutBucketCORS(_ context.Context, bktInfo *data.BucketInfo, objID oid.ID) (oid.ID, error) {
systemMap, ok := t.system[bktInfo.CID.EncodeToString()] systemMap, ok := t.system[bktInfo.CID.EncodeToString()]
if !ok { if !ok {
systemMap = make(map[string]*data.BaseNodeVersion) systemMap = make(map[string]*data.BaseNodeVersion)
@ -137,7 +137,7 @@ func (t *TreeServiceMock) PutBucketCORS(ctx context.Context, bktInfo *data.Bucke
return oid.ID{}, ErrNoNodeToRemove return oid.ID{}, ErrNoNodeToRemove
} }
func (t *TreeServiceMock) DeleteBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) (oid.ID, error) { func (t *TreeServiceMock) DeleteBucketCORS(context.Context, *data.BucketInfo) (oid.ID, error) {
panic("implement me") panic("implement me")
} }
@ -314,7 +314,7 @@ func (t *TreeServiceMock) CreateMultipartUpload(_ context.Context, bktInfo *data
return nil return nil
} }
func (t *TreeServiceMock) GetMultipartUploadsByPrefix(ctx context.Context, bktInfo *data.BucketInfo, prefix string) ([]*data.MultipartInfo, error) { func (t *TreeServiceMock) GetMultipartUploadsByPrefix(context.Context, *data.BucketInfo, string) ([]*data.MultipartInfo, error) {
panic("implement me") panic("implement me")
} }
@ -407,7 +407,7 @@ LOOP:
return nil return nil
} }
func (t *TreeServiceMock) PutLock(ctx context.Context, bktInfo *data.BucketInfo, nodeID uint64, lock *data.LockInfo) error { func (t *TreeServiceMock) PutLock(_ context.Context, bktInfo *data.BucketInfo, nodeID uint64, lock *data.LockInfo) error {
cnrLockMap, ok := t.locks[bktInfo.CID.EncodeToString()] cnrLockMap, ok := t.locks[bktInfo.CID.EncodeToString()]
if !ok { if !ok {
t.locks[bktInfo.CID.EncodeToString()] = map[uint64]*data.LockInfo{ t.locks[bktInfo.CID.EncodeToString()] = map[uint64]*data.LockInfo{
@ -421,7 +421,7 @@ func (t *TreeServiceMock) PutLock(ctx context.Context, bktInfo *data.BucketInfo,
return nil return nil
} }
func (t *TreeServiceMock) GetLock(ctx context.Context, bktInfo *data.BucketInfo, nodeID uint64) (*data.LockInfo, error) { func (t *TreeServiceMock) GetLock(_ context.Context, bktInfo *data.BucketInfo, nodeID uint64) (*data.LockInfo, error) {
cnrLockMap, ok := t.locks[bktInfo.CID.EncodeToString()] cnrLockMap, ok := t.locks[bktInfo.CID.EncodeToString()]
if !ok { if !ok {
return nil, nil return nil, nil

View file

@ -74,7 +74,7 @@ func objectInfoFromMeta(bkt *data.BucketInfo, meta *object.Object) *data.ObjectI
mimeType = contentType mimeType = contentType
delete(headers, object.AttributeContentType) delete(headers, object.AttributeContentType)
} }
if val, ok := headers[object.AttributeTimestamp]; !ok { if val, ok := headers[object.AttributeTimestamp]; !ok { //nolint:revive
// ignore empty value // ignore empty value
} else if dt, err := strconv.ParseInt(val, 10, 64); err == nil { } else if dt, err := strconv.ParseInt(val, 10, 64); err == nil {
creation = time.Unix(dt, 0) creation = time.Unix(dt, 0)

View file

@ -131,7 +131,7 @@ func NewController(p *Options, l *zap.Logger) (*Controller, error) {
}, nil }, nil
} }
func (c *Controller) Subscribe(ctx context.Context, topic string, handler layer.MsgHandler) error { func (c *Controller) Subscribe(_ context.Context, topic string, handler layer.MsgHandler) error {
ch := make(chan *nats.Msg, 1) ch := make(chan *nats.Msg, 1)
c.mu.RLock() c.mu.RLock()

View file

@ -421,11 +421,7 @@ func bindFlags(v *viper.Viper, flags *pflag.FlagSet) error {
if err := v.BindPFlag(cfgServer+".0."+cfgTLSKeyFile, flags.Lookup(cfgTLSKeyFile)); err != nil { if err := v.BindPFlag(cfgServer+".0."+cfgTLSKeyFile, flags.Lookup(cfgTLSKeyFile)); err != nil {
return err return err
} }
if err := v.BindPFlag(cfgServer+".0."+cfgTLSCertFile, flags.Lookup(cfgTLSCertFile)); err != nil { return v.BindPFlag(cfgServer+".0."+cfgTLSCertFile, flags.Lookup(cfgTLSCertFile))
return err
}
return nil
} }
func readInConfig(v *viper.Viper) error { func readInConfig(v *viper.Viper) error {
@ -489,11 +485,7 @@ func mergeConfig(v *viper.Viper, fileName string) error {
} }
}() }()
if err = v.MergeConfig(cfgFile); err != nil { return v.MergeConfig(cfgFile)
return err
}
return nil
} }
// newLogger constructs a Logger instance for the current application. // newLogger constructs a Logger instance for the current application.

View file

@ -183,7 +183,7 @@ func NewTreeServiceClientMemory() (*ServiceClientMemory, error) {
}, nil }, nil
} }
func (c *ServiceClientMemory) GetNodes(ctx context.Context, p *GetNodesParams) ([]NodeResponse, error) { func (c *ServiceClientMemory) GetNodes(_ context.Context, p *GetNodesParams) ([]NodeResponse, error) {
cnr, ok := c.containers[p.BktInfo.CID.EncodeToString()] cnr, ok := c.containers[p.BktInfo.CID.EncodeToString()]
if !ok { if !ok {
return nil, nil return nil, nil
@ -211,7 +211,7 @@ func (c *ServiceClientMemory) GetNodes(ctx context.Context, p *GetNodesParams) (
return res2, nil return res2, nil
} }
func (c *ServiceClientMemory) GetSubTree(ctx context.Context, bktInfo *data.BucketInfo, treeID string, rootID uint64, depth uint32) ([]NodeResponse, error) { func (c *ServiceClientMemory) GetSubTree(_ context.Context, bktInfo *data.BucketInfo, treeID string, rootID uint64, depth uint32) ([]NodeResponse, error) {
cnr, ok := c.containers[bktInfo.CID.EncodeToString()] cnr, ok := c.containers[bktInfo.CID.EncodeToString()]
if !ok { if !ok {
return nil, nil return nil, nil
@ -257,7 +257,7 @@ func newMemoryTree() memoryTree {
} }
} }
func (c *ServiceClientMemory) AddNode(ctx context.Context, bktInfo *data.BucketInfo, treeID string, parent uint64, meta map[string]string) (uint64, error) { func (c *ServiceClientMemory) AddNode(_ context.Context, bktInfo *data.BucketInfo, treeID string, parent uint64, meta map[string]string) (uint64, error) {
cnr, ok := c.containers[bktInfo.CID.EncodeToString()] cnr, ok := c.containers[bktInfo.CID.EncodeToString()]
if !ok { if !ok {
cnr = newContainerInfo(bktInfo, treeID) cnr = newContainerInfo(bktInfo, treeID)
@ -294,7 +294,7 @@ func (c *ServiceClientMemory) AddNode(ctx context.Context, bktInfo *data.BucketI
return newID, nil return newID, nil
} }
func (c *ServiceClientMemory) AddNodeByPath(ctx context.Context, bktInfo *data.BucketInfo, treeID string, path []string, meta map[string]string) (uint64, error) { func (c *ServiceClientMemory) AddNodeByPath(_ context.Context, bktInfo *data.BucketInfo, treeID string, path []string, meta map[string]string) (uint64, error) {
cnr, ok := c.containers[bktInfo.CID.EncodeToString()] cnr, ok := c.containers[bktInfo.CID.EncodeToString()]
if !ok { if !ok {
cnr = newContainerInfo(bktInfo, treeID) cnr = newContainerInfo(bktInfo, treeID)
@ -331,7 +331,7 @@ func (c *ServiceClientMemory) AddNodeByPath(ctx context.Context, bktInfo *data.B
return newID, nil return newID, nil
} }
func (c *ServiceClientMemory) MoveNode(ctx context.Context, bktInfo *data.BucketInfo, treeID string, nodeID, parentID uint64, meta map[string]string) error { func (c *ServiceClientMemory) MoveNode(_ context.Context, bktInfo *data.BucketInfo, treeID string, nodeID, parentID uint64, meta map[string]string) error {
cnr, ok := c.containers[bktInfo.CID.EncodeToString()] cnr, ok := c.containers[bktInfo.CID.EncodeToString()]
if !ok { if !ok {
return ErrNodeNotFound return ErrNodeNotFound
@ -361,7 +361,7 @@ func (c *ServiceClientMemory) MoveNode(ctx context.Context, bktInfo *data.Bucket
return nil return nil
} }
func (c *ServiceClientMemory) RemoveNode(ctx context.Context, bktInfo *data.BucketInfo, treeID string, nodeID uint64) error { func (c *ServiceClientMemory) RemoveNode(_ context.Context, bktInfo *data.BucketInfo, treeID string, nodeID uint64) error {
cnr, ok := c.containers[bktInfo.CID.EncodeToString()] cnr, ok := c.containers[bktInfo.CID.EncodeToString()]
if !ok { if !ok {
return ErrNodeNotFound return ErrNodeNotFound