Skip to content

Commit

Permalink
Add more info
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Jun 9, 2023
1 parent ce7623b commit 399f124
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
18 changes: 18 additions & 0 deletions cmd/radiance/car/dump2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"io/fs"
"os"
"runtime/debug"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -68,6 +69,23 @@ func main() {
fmt.Printf("Dump tool for Solana CAR files.\n")
fmt.Printf("Tag/Branch: %s\n", GitTag)
fmt.Printf("Commit: %s\n", GitCommit)
if info, ok := debug.ReadBuildInfo(); ok {
fmt.Printf("More info:\n")
for _, setting := range info.Settings {
if isAnyOf(setting.Key,
"-compiler",
"GOARCH",
"GOOS",
"GOAMD64",
"vcs",
"vcs.revision",
"vcs.time",
"vcs.modified",
) {
fmt.Printf(" %s: %s\n", setting.Key, setting.Value)
}
}
}
os.Exit(0)
}
var flagPrintFilter string
Expand Down
32 changes: 31 additions & 1 deletion cmd/radiance/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package main
import (
"context"
"flag"
"fmt"
"os"
"os/signal"
"runtime/debug"

"github.com/spf13/cobra"
"go.firedancer.io/radiance/cmd/radiance/blockstore"
Expand Down Expand Up @@ -49,10 +51,38 @@ var (
GitTag string
)

func isAnyOf(s string, anyOf ...string) bool {
for _, v := range anyOf {
if s == v {
return true
}
}
return false
}

var versionCmd = cobra.Command{
Use: "version",
Short: "Print the version number of Radiance",
Run: func(cmd *cobra.Command, args []string) {
klog.Infof("Radiance built from tag/branch %q (commit: %s)", GitTag, GitCommit)
fmt.Printf("Radiance.\n")
fmt.Printf("Tag/Branch: %s\n", GitTag)
fmt.Printf("Commit: %s\n", GitCommit)
if info, ok := debug.ReadBuildInfo(); ok {
fmt.Printf("More info:\n")
for _, setting := range info.Settings {
if isAnyOf(setting.Key,
"-compiler",
"GOARCH",
"GOOS",
"GOAMD64",
"vcs",
"vcs.revision",
"vcs.time",
"vcs.modified",
) {
fmt.Printf(" %s: %s\n", setting.Key, setting.Value)
}
}
}
},
}

0 comments on commit 399f124

Please sign in to comment.