From d5b3af1f8646fc6d6fa6b6fa5737559a1a473fd7 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Mon, 24 Feb 2025 09:05:38 -0800 Subject: [PATCH] Correctly distinguish missing on_create argv from error --- cmd/actionList.go | 4 +++- core/action.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/actionList.go b/cmd/actionList.go index 62db398..a8d2e93 100644 --- a/cmd/actionList.go +++ b/cmd/actionList.go @@ -49,7 +49,9 @@ func actionList(source string, argv bool) { if err != nil { log.Fatalf("error: could not get argv for source %s action %s: %v", source, name, err) } - actionArgv[name] = argv + if argv != nil { + actionArgv[name] = argv + } } for _, name := range actions { fmt.Printf("%s %v\n", name, actionArgv[name]) diff --git a/core/action.go b/core/action.go index 09695aa..da67bfe 100644 --- a/core/action.go +++ b/core/action.go @@ -1,6 +1,7 @@ package core import ( + "database/sql" "database/sql/driver" "encoding/json" ) @@ -57,6 +58,9 @@ func GetArgvForAction(db DB, source string, name string) ([]string, error) { `, source, name) var argv argList err := rows.Scan(&argv) + if err == sql.ErrNoRows { + return nil, nil + } if err != nil { return nil, err }