all: fix golangci failures

Change-Id: I07421388d53c837e35a4727cead26fc21c324d04
This commit is contained in:
Egon Elbre 2023-08-09 10:55:24 +03:00
parent 9e3d54fec4
commit dc41978743
6 changed files with 12 additions and 12 deletions

View File

@ -255,7 +255,8 @@ func (process *Process) Exec(ctx context.Context, command string) (err error) {
if _, ok := process.Arguments[command]; !ok {
fmt.Fprintf(process.processes.Output, "%s running: %s\n", process.Name, command)
return
//TODO: This doesn't look right, but keeping the same behaviour as before.
return nil
}
cmd := exec.CommandContext(ctx, executable, process.Arguments[command]...)

View File

@ -656,7 +656,7 @@ func (server *Server) checkUsage(ctx context.Context, w http.ResponseWriter, pro
if err != nil {
sendJSONError(w, "unable to get project details",
err.Error(), http.StatusInternalServerError)
return
return false
}
// If user is paid tier, check the usage limit, otherwise it is ok to delete it.
@ -664,7 +664,7 @@ func (server *Server) checkUsage(ctx context.Context, w http.ResponseWriter, pro
if err != nil {
sendJSONError(w, "unable to project owner tier",
err.Error(), http.StatusInternalServerError)
return
return false
}
if paid {
// check current month usage and do not allow deletion if usage exists

View File

@ -199,16 +199,14 @@ func TestDeleteAccount(t *testing.T) {
authController := consoleapi.NewAuth(log, nil, nil, nil, nil, nil, "", "", "", "", "", "")
authController.DeleteAccount(rr, r)
//nolint:bodyclose
result := rr.Result()
defer func() {
err := result.Body.Close()
require.NoError(t, err)
}()
body, err := io.ReadAll(result.Body)
require.NoError(t, err)
err = result.Body.Close()
require.NoError(t, err)
return result.StatusCode, body
}

View File

@ -264,8 +264,9 @@ func convertToFinalSegments(segmentsInDatabase []segmentInfoForCommit) (commit [
// updateSegmentOffsets updates segment offsets that didn't match the database state.
func updateSegmentOffsets(ctx context.Context, tx tagsql.Tx, streamID uuid.UUID, updates []segmentToCommit) (err error) {
defer mon.Task()(&ctx)(&err)
if len(updates) == 0 {
return
return nil
}
// We may be able to skip this, if the database state have been already submitted

View File

@ -363,7 +363,7 @@ func (cache *overlaycache) GetOfflineNodesForEmail(ctx context.Context, offlineW
LIMIT $4
`, now.Add(-offlineWindow), now.Add(-cutoff), now.Add(-cooldown), limit)
if err != nil {
return
return nil, Error.Wrap(err)
}
defer func() { err = errs.Combine(err, rows.Close()) }()
@ -374,7 +374,7 @@ func (cache *overlaycache) GetOfflineNodesForEmail(ctx context.Context, offlineW
err = rows.Scan(&idBytes, &email)
nodeID, err = storj.NodeIDFromBytes(idBytes)
if err != nil {
return
return nil, Error.Wrap(err)
}
nodes[nodeID] = email
}

View File

@ -140,7 +140,7 @@ func (fw *FileWalker) WalkSatellitePiecesToTrash(ctx context.Context, satelliteI
defer mon.Task()(&ctx)(&err)
if filter == nil {
return
return nil, 0, 0, Error.New("filter not specified")
}
err = fw.WalkSatellitePieces(ctx, satelliteID, func(access StoredPieceAccess) error {