export Trailer struct fields
This commit is contained in:
parent
0e26174be2
commit
ca080d554e
|
@ -11,8 +11,8 @@ import (
|
|||
|
||||
// Trailer represents a single git message trailer.
|
||||
type Trailer struct {
|
||||
key string
|
||||
value string
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
// MessageTrailers parses trailers out of a message, returning a slice of
|
||||
|
@ -37,7 +37,7 @@ func MessageTrailers(message string) ([]Trailer, error) {
|
|||
var trailer *C.git_message_trailer
|
||||
for i, p := 0, uintptr(unsafe.Pointer(trailersC.trailers)); i < int(trailersC.count); p += unsafe.Sizeof(C.git_message_trailer{}) {
|
||||
trailer = (*C.git_message_trailer)(unsafe.Pointer(p))
|
||||
trailers[i] = Trailer{key: C.GoString(trailer.key), value: C.GoString(trailer.value)}
|
||||
trailers[i] = Trailer{Key: C.GoString(trailer.key), Value: C.GoString(trailer.value)}
|
||||
i++
|
||||
}
|
||||
return trailers, nil
|
||||
|
|
|
@ -19,14 +19,14 @@ func TestTrailers(t *testing.T) {
|
|||
{
|
||||
"commit with one trailer\n\nCo-authored-by: Alice <alice@example.com>\n",
|
||||
[]Trailer{
|
||||
Trailer{key: "Co-authored-by", value: "Alice <alice@example.com>"},
|
||||
Trailer{Key: "Co-authored-by", Value: "Alice <alice@example.com>"},
|
||||
},
|
||||
},
|
||||
{
|
||||
"commit with two trailers\n\nCo-authored-by: Alice <alice@example.com>\nSigned-off-by: Bob <bob@example.com>\n",
|
||||
[]Trailer{
|
||||
Trailer{key: "Co-authored-by", value: "Alice <alice@example.com>"},
|
||||
Trailer{key: "Signed-off-by", value: "Bob <bob@example.com>"}},
|
||||
Trailer{Key: "Co-authored-by", Value: "Alice <alice@example.com>"},
|
||||
Trailer{Key: "Signed-off-by", Value: "Bob <bob@example.com>"}},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
|
|
Loading…
Reference in New Issue