diff pkg/imports/queue.go @ 5712:6270951dda28 revive-cleanup

/interface{}/any/
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 20 Feb 2024 22:37:51 +0100
parents 2dd155cc95ec
children 0542aec69375
line wrap: on
line diff
--- a/pkg/imports/queue.go	Tue Feb 20 22:22:57 2024 +0100
+++ b/pkg/imports/queue.go	Tue Feb 20 22:37:51 2024 +0100
@@ -39,11 +39,11 @@
 	// informations, warnings or errors.
 	Feedback interface {
 		// Info logs informations.
-		Info(fmt string, args ...interface{})
+		Info(fmt string, args ...any)
 		// Warn logs warnings.
-		Warn(fmt string, args ...interface{})
+		Warn(fmt string, args ...any)
 		// Error logs errors.
-		Error(fmt string, args ...interface{})
+		Error(fmt string, args ...any)
 	}
 
 	// UnchangedError may be issued by Do of a Job to indicate
@@ -61,7 +61,7 @@
 		// be successfull. The non-error return value is
 		// serialized as a JSON string into the database as
 		// a summary to the import to be used by the review process.
-		Do(ctx context.Context, id int64, conn *sql.Conn, feedback Feedback) (interface{}, error)
+		Do(ctx context.Context, id int64, conn *sql.Conn, feedback Feedback) (any, error)
 		// CleanUp is called to clean up ressources hold by the import.
 		// It is called whether the import succeeded or not.
 		CleanUp() error
@@ -295,7 +295,7 @@
 	importID int64,
 	conn *sql.Conn,
 	_ Feedback,
-) (interface{}, error) {
+) (any, error) {
 
 	tx, err := conn.BeginTx(ctx, nil)
 	if err != nil {
@@ -749,7 +749,7 @@
 
 type logFeedback int64
 
-func (lf logFeedback) log(kind, format string, args ...interface{}) {
+func (lf logFeedback) log(kind, format string, args ...any) {
 	ctx := context.Background()
 	err := auth.RunAs(ctx, queueUser, func(conn *sql.Conn) error {
 		_, err := conn.ExecContext(
@@ -761,15 +761,15 @@
 	}
 }
 
-func (lf logFeedback) Info(format string, args ...interface{}) {
+func (lf logFeedback) Info(format string, args ...any) {
 	lf.log("info", format, args...)
 }
 
-func (lf logFeedback) Warn(format string, args ...interface{}) {
+func (lf logFeedback) Warn(format string, args ...any) {
 	lf.log("warn", format, args...)
 }
 
-func (lf logFeedback) Error(format string, args ...interface{}) {
+func (lf logFeedback) Error(format string, args ...any) {
 	lf.log("error", format, args...)
 }
 
@@ -900,7 +900,7 @@
 	ctx context.Context,
 	id int64,
 	state string,
-	summary interface{},
+	summary any,
 ) error {
 	var s sql.NullString
 	if summary != nil {
@@ -924,7 +924,7 @@
 	})
 }
 
-func errorAndFail(id int64, format string, args ...interface{}) error {
+func errorAndFail(id int64, format string, args ...any) error {
 	ctx := context.Background()
 	return tryHardToStoreState(ctx, func(conn *sql.Conn) error {
 		tx, err := conn.BeginTx(ctx, nil)
@@ -1020,7 +1020,7 @@
 			}
 
 			ctx := context.Background()
-			var summary interface{}
+			var summary any
 
 			errDo := survive(func() error {
 				return auth.RunAs(ctx, idj.user,