From 1dbf0c0ad6cabfc35aa1896b4d94f4ee811ba803 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Thu, 1 Mar 2018 12:19:07 +0100 Subject: userdiff: add built-in pattern for golang This adds xfuncname and word_regex patterns for golang, a quite popular programming language. It also includes test cases for the xfuncname regex (t4018) and updated documentation. The xfuncname regex finds functions, structs and interfaces. Although the Go language prohibits the opening brace from being on its own line, the regex does not makes it mandatory, to be able to match `func` statements like this: func foo(bar int, baz int) { } This is covered by the test case t4018/golang-long-func. The word_regex pattern finds identifiers, integers, floats, complex numbers and operators, according to the go specification. Signed-off-by: Alban Gruin Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Documentation') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index c21f5ca109..d52b254a22 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -714,6 +714,8 @@ patterns are available: - `fountain` suitable for Fountain documents. +- `golang` suitable for source code in the Go language. + - `html` suitable for HTML/XHTML documents. - `java` suitable for source code in the Java language. -- cgit v1.2.3