Skip to content

Commit 8d0a4fa

Browse files
committed
use short revision
1 parent 61dc76c commit 8d0a4fa

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

version.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package king
22

33
import (
44
"bytes"
5+
"errors"
56
"fmt"
67
"runtime"
78
"strings"
@@ -71,7 +72,11 @@ type Option func(*BuildInfo) error
7172
// WithRevision sets the git commit revision.
7273
func WithRevision(r string) Option {
7374
return func(b *BuildInfo) error {
74-
b.revision = r
75+
if len(r) < 8 {
76+
return errors.New("build revision must be at least 8 chars long")
77+
}
78+
79+
b.revision = r[:8]
7580

7681
return nil
7782
}

0 commit comments

Comments
 (0)