]> git.ipfire.org Git - thirdparty/git.git/commit - userdiff.c
userdiff: add built-in pattern for golang
authorAlban Gruin <alban.gruin@gmail.com>
Thu, 1 Mar 2018 11:19:07 +0000 (12:19 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Mar 2018 21:36:49 +0000 (13:36 -0800)
commit1dbf0c0ad6cabfc35aa1896b4d94f4ee811ba803
treeb987310dcd5bda9990ccb1c76dcd327a494048c1
parent7e31236f652ad9db221511eaf157ce0ef55585d6
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 <alban.gruin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/gitattributes.txt
t/t4018-diff-funcname.sh
t/t4018/golang-complex-function [new file with mode: 0644]
t/t4018/golang-func [new file with mode: 0644]
t/t4018/golang-interface [new file with mode: 0644]
t/t4018/golang-long-func [new file with mode: 0644]
t/t4018/golang-struct [new file with mode: 0644]
userdiff.c