@@ -3,6 +3,16 @@
# See ../t4018-diff-funcname.sh's test_diff_funcname()
#
+test_diff_funcname 'golang: package' \
+ 8<<\EOF_HUNK 9<<\EOF_TEST
+package main
+EOF_HUNK
+package main
+
+import "fmt"
+// ChangeMe
+EOF_TEST
+
test_diff_funcname 'golang: complex function' \
8<<\EOF_HUNK 9<<\EOF_TEST
func (t *Test) RIGHT(a Type) (Type, error) {
@@ -124,6 +124,8 @@ IPATTERN("fortran",
IPATTERN("fountain", "^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$",
"[^ \t-]+"),
PATTERNS("golang",
+ /* Packages */
+ "^[ \t]*(package[ \t]*(.*))\n"
/* Functions */
"^[ \t]*(func[ \t]*.*(\\{[ \t]*)?)\n"
/* Structs and interfaces */
Improve the "golang" built-in pattern to match "package" lines, as they weren't matched before changing e.g. the imports would commonly result in an empty hunk header, now we'll instead show the package name. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- t/t4018/golang.sh | 10 ++++++++++ userdiff.c | 2 ++ 2 files changed, 12 insertions(+)