From df144e727a858ed07e3c9328d91efe052c4781e1 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 13 Aug 2018 15:28:16 +0200 Subject: fix some linting trouble --- util/hash.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'util') diff --git a/util/hash.go b/util/hash.go index df0a83b8..0a3964a0 100644 --- a/util/hash.go +++ b/util/hash.go @@ -5,12 +5,14 @@ import ( "io" ) +// Hash is a git hash type Hash string func (h Hash) String() string { return string(h) } +// UnmarshalGQL implement the Unmarshaler interface for gqlgen func (h *Hash) UnmarshalGQL(v interface{}) error { _, ok := v.(string) if !ok { @@ -26,10 +28,12 @@ func (h *Hash) UnmarshalGQL(v interface{}) error { return nil } +// MarshalGQL implement the Marshaler interface for gqlgen func (h Hash) MarshalGQL(w io.Writer) { w.Write([]byte(`"` + h.String() + `"`)) } +// IsValid tell if the hash is valid func (h *Hash) IsValid() bool { if len(*h) != 40 { return false -- cgit