File tree Expand file tree Collapse file tree 2 files changed +8
-30
lines changed
cmd/dependabot/internal/cmd Expand file tree Collapse file tree 2 files changed +8
-30
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,7 @@ Use any of the following for a pain-free installation:
1818 ```
1919 The benefit of this method is that re-running the command will always update to the latest version.
2020* You can download a pre-built binary from the [ releases] page.
21- * If you have the [ ` gh ` ] [ gh ] command available, you can install the latest release
22- of ` dependabot ` using the following command ([ gist source] ( https://gist.github.com/mattt/e09e1ecd76d5573e0517a7622009f06f ) ):
23- ``` shell
24- gh gist view --raw e09e1ecd76d5573e0517a7622009f06f | bash
25- ```
21+ * On Mac, you can run ` brew install dependabot `
2622
2723## Requirements
2824
Original file line number Diff line number Diff line change 11package cmd
22
33import (
4- "fmt"
5- "regexp"
4+ "log"
65 "runtime/debug"
76)
87
98// ldflags inserts the version here on release
109var version string
1110
12- var timestampRegex = regexp .MustCompile ("[^a-zA-Z0-9]+" )
13-
1411func Version () string {
1512 if version == "" {
1613 version = "0.0.0-dev"
17- commit := ""
18- timestamp := ""
19- modified := false
20-
21- info , _ := debug .ReadBuildInfo ()
22- for _ , entry := range info .Settings {
23- if entry .Key == "vcs.revision" && len (entry .Value ) >= 7 {
24- commit = entry .Value [:7 ] // short ref
25- }
2614
27- if entry .Key == "vcs.modified" {
28- modified = entry .Value == "true"
29- }
30-
31- if entry .Key == "vcs.time" {
32- timestamp = timestampRegex .ReplaceAllString (entry .Value , "" )
33- }
15+ info , ok := debug .ReadBuildInfo ()
16+ if ! ok {
17+ log .Println ("debug.ReadBuildInfo failed" )
18+ return version
3419 }
35-
36- if modified && timestamp != "" {
37- return fmt .Sprintf ("%s+%s" , version , timestamp )
38- } else if commit != "" {
39- return fmt .Sprintf ("%s+%s" , version , commit )
20+ if info .Main .Version != "" {
21+ version = info .Main .Version
4022 }
4123 }
4224
You can’t perform that action at this time.
0 commit comments