|
| 1 | +// Copyright 2019 OVO Technology |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
1 | 15 | package cmd
|
2 | 16 |
|
3 | 17 | import (
|
4 | 18 | "fmt"
|
5 | 19 | "strconv"
|
6 | 20 |
|
| 21 | + "github.com/ovotech/cloud-key-rotator/pkg/build" |
7 | 22 | "github.com/spf13/cobra"
|
8 | 23 | )
|
9 | 24 |
|
10 | 25 | var (
|
11 |
| - defaultLdFlag = "-" |
12 |
| - version = defaultLdFlag |
13 |
| - commit = defaultLdFlag |
14 |
| - date = defaultLdFlag |
15 |
| - osArch = defaultLdFlag |
16 | 26 | versionField = "Version"
|
17 | 27 | gitCommitField = "Git commit"
|
18 | 28 | builtField = "Built"
|
19 | 29 | osArchField = "OS/Arch"
|
20 | 30 | ldFlags = map[string]string{
|
21 |
| - versionField: version, |
22 |
| - gitCommitField: commit, |
23 |
| - builtField: date, |
24 |
| - osArchField: osArch} |
| 31 | + versionField: build.Version, |
| 32 | + gitCommitField: build.Commit, |
| 33 | + builtField: build.Date, |
| 34 | + osArchField: build.OsArch} |
25 | 35 | //map insertion order isn't maintained, so use a slice for that
|
26 | 36 | ldFlagOrder = []string{versionField, gitCommitField, builtField, osArchField}
|
27 | 37 | formatString = "%-" + strconv.Itoa(maxLength(ldFlagOrder)+2) + "v%s\n"
|
|
0 commit comments