Skip to content

Commit

Permalink
use short revision
Browse files Browse the repository at this point in the history
  • Loading branch information
zbindenren committed Nov 2, 2020
1 parent 61dc76c commit 8d0a4fa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package king

import (
"bytes"
"errors"
"fmt"
"runtime"
"strings"
Expand Down Expand Up @@ -71,7 +72,11 @@ type Option func(*BuildInfo) error
// WithRevision sets the git commit revision.
func WithRevision(r string) Option {
return func(b *BuildInfo) error {
b.revision = r
if len(r) < 8 {
return errors.New("build revision must be at least 8 chars long")
}

b.revision = r[:8]

return nil
}
Expand Down

0 comments on commit 8d0a4fa

Please sign in to comment.