Repository: gohugoio/hugo (language: go)

Issue:
Wrong shortcode name in error message on self-closing shortcodes with no .Inner
```
 failed to extract shortcode: shortcode ">}}" does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided`
```


Discussion / hints:

Fix patch:
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
index 69e891adbf7..9a2bb7aeb09 100644
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -650,7 +650,11 @@ Loop:
 						// return that error, more specific
 						continue
 					}
-					return nil, fmt.Errorf("%s: shortcode %q does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided", errorPrefix, next.ValStr(source))
+					name := sc.name
+					if name == "" {
+						name = next.ValStr(source)
+					}
+					return nil, fmt.Errorf("%s: shortcode %q does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided", errorPrefix, name)
 				}
 			}
 			if next.IsRightShortcodeDelim() {


Test patch:
diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go
index 92812bf660d..5799de45279 100644
--- a/hugolib/shortcode_test.go
+++ b/hugolib/shortcode_test.go
@@ -831,19 +831,35 @@ title: "Hugo Rocks!"
 func TestShortcodeNoInner(t *testing.T) {
 	t.Parallel()
 
-	b := newTestSitesBuilder(t)
-
-	b.WithContent("mypage.md", `---
+	files := `
+-- hugo.toml --
+baseURL = "https://example.org"
+disableKinds = ["term", "taxonomy", "home", "section"]
+-- content/mypage.md --
+---
 title: "No Inner!"
 ---
+
 {{< noinner >}}{{< /noinner >}}
 
+-- layouts/shortcodes/noinner.html --
+No inner here.
+-- layouts/_default/single.html --
+Content: {{ .Content }}|
 
-`).WithTemplatesAdded(
-		"layouts/shortcodes/noinner.html", `No inner here.`)
+`
+
+	b, err := TestE(t, files)
+
+	assert := func() {
+		b.Assert(err.Error(), qt.Contains, filepath.FromSlash(`failed to extract shortcode: shortcode "noinner" does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided`))
+	}
 
-	err := b.BuildE(BuildCfg{})
-	b.Assert(err.Error(), qt.Contains, filepath.FromSlash(`"content/mypage.md:4:16": failed to extract shortcode: shortcode "noinner" does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided`))
+	assert()
+
+	b, err = TestE(t, strings.Replace(files, `{{< noinner >}}{{< /noinner >}}`, `{{< noinner />}}`, 1))
+
+	assert()
 }
 
 func TestShortcodeStableOutputFormatTemplates(t *testing.T) {