Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Jan 29, 2020
1 parent f49ec5b commit 6d8a860
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/buildinfo/buildinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@ var (
date = unknown
)

// Version returns version from git describe.
func Version() string {
return version
}

// Commit returns commit hash.
func Commit() string {
return commit
}

// Date returns date of build in RFC3339 format.
func Date() string {
return date
}

// Get returns build info summary.
func Get() *Info {
return &Info{
Version: Version(),
Expand All @@ -33,13 +37,16 @@ func Get() *Info {
}
}

// Info is build info summary.
type Info struct {
Version string `json:"version"`
Commit string `json:"commit"`
Date string `json:"date"`
}

func (info *Info) WriteTo(w io.Writer) (n int, err error) {
// WriteTo writes build info summary to io.Writer.
func (info *Info) WriteTo(w io.Writer) (int64, error) {
msg := fmt.Sprintf("Version %q built on %q agaist commit %q\n", info.Version, info.Date, info.Commit)
return w.Write([]byte(msg))
n, err := w.Write([]byte(msg))
return int64(n), err
}

0 comments on commit 6d8a860

Please sign in to comment.