cmd/geth, node: surface geth architecture into version (#13866)

This commit is contained in:
Péter Szilágyi 2017-04-05 22:51:01 +03:00 committed by Felix Lange
parent cc303017c3
commit 24b9860c1b
4 changed files with 8 additions and 5 deletions

@ -45,6 +45,7 @@ func TestConsoleWelcome(t *testing.T) {
// Gather all the infos the welcome message needs to contain // Gather all the infos the welcome message needs to contain
geth.setTemplateFunc("goos", func() string { return runtime.GOOS }) geth.setTemplateFunc("goos", func() string { return runtime.GOOS })
geth.setTemplateFunc("goarch", func() string { return runtime.GOARCH })
geth.setTemplateFunc("gover", runtime.Version) geth.setTemplateFunc("gover", runtime.Version)
geth.setTemplateFunc("gethver", func() string { return params.Version }) geth.setTemplateFunc("gethver", func() string { return params.Version })
geth.setTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) }) geth.setTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) })
@ -58,7 +59,7 @@ func TestConsoleWelcome(t *testing.T) {
geth.expect(` geth.expect(`
Welcome to the Geth JavaScript console! Welcome to the Geth JavaScript console!
instance: Geth/v{{gethver}}/{{goos}}/{{gover}} instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}}
coinbase: {{.Etherbase}} coinbase: {{.Etherbase}}
at block: 0 ({{niltime}}) at block: 0 ({{niltime}})
datadir: {{.Datadir}} datadir: {{.Datadir}}
@ -131,6 +132,7 @@ func testAttachWelcome(t *testing.T, geth *testgeth, endpoint string) {
// Gather all the infos the welcome message needs to contain // Gather all the infos the welcome message needs to contain
attach.setTemplateFunc("goos", func() string { return runtime.GOOS }) attach.setTemplateFunc("goos", func() string { return runtime.GOOS })
attach.setTemplateFunc("goarch", func() string { return runtime.GOARCH })
attach.setTemplateFunc("gover", runtime.Version) attach.setTemplateFunc("gover", runtime.Version)
attach.setTemplateFunc("gethver", func() string { return params.Version }) attach.setTemplateFunc("gethver", func() string { return params.Version })
attach.setTemplateFunc("etherbase", func() string { return geth.Etherbase }) attach.setTemplateFunc("etherbase", func() string { return geth.Etherbase })
@ -152,7 +154,7 @@ func testAttachWelcome(t *testing.T, geth *testgeth, endpoint string) {
attach.expect(` attach.expect(`
Welcome to the Geth JavaScript console! Welcome to the Geth JavaScript console!
instance: Geth/v{{gethver}}/{{goos}}/{{gover}} instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}}
coinbase: {{etherbase}} coinbase: {{etherbase}}
at block: 0 ({{niltime}}){{if ipc}} at block: 0 ({{niltime}}){{if ipc}}
datadir: {{datadir}}{{end}} datadir: {{datadir}}{{end}}

@ -101,10 +101,11 @@ func version(ctx *cli.Context) error {
if gitCommit != "" { if gitCommit != "" {
fmt.Println("Git Commit:", gitCommit) fmt.Println("Git Commit:", gitCommit)
} }
fmt.Println("Architecture:", runtime.GOARCH)
fmt.Println("Protocol Versions:", eth.ProtocolVersions) fmt.Println("Protocol Versions:", eth.ProtocolVersions)
fmt.Println("Network Id:", ctx.GlobalInt(utils.NetworkIdFlag.Name)) fmt.Println("Network Id:", ctx.GlobalInt(utils.NetworkIdFlag.Name))
fmt.Println("Go Version:", runtime.Version()) fmt.Println("Go Version:", runtime.Version())
fmt.Println("OS:", runtime.GOOS) fmt.Println("Operating System:", runtime.GOOS)
fmt.Printf("GOPATH=%s\n", os.Getenv("GOPATH")) fmt.Printf("GOPATH=%s\n", os.Getenv("GOPATH"))
fmt.Printf("GOROOT=%s\n", runtime.GOROOT()) fmt.Printf("GOROOT=%s\n", runtime.GOROOT())
return nil return nil

@ -266,7 +266,7 @@ func (c *Config) NodeName() string {
if c.Version != "" { if c.Version != "" {
name += "/v" + c.Version name += "/v" + c.Version
} }
name += "/" + runtime.GOOS name += "/" + runtime.GOOS + "-" + runtime.GOARCH
name += "/" + runtime.Version() name += "/" + runtime.Version()
return name return name
} }

@ -173,7 +173,7 @@ func (n *Node) Start() error {
MaxPendingPeers: n.config.MaxPendingPeers, MaxPendingPeers: n.config.MaxPendingPeers,
} }
running := &p2p.Server{Config: n.serverConfig} running := &p2p.Server{Config: n.serverConfig}
log.Info(fmt.Sprint("instance:", n.serverConfig.Name)) log.Info("Starting peer-to-peer node", "instance", n.serverConfig.Name)
// Otherwise copy and specialize the P2P configuration // Otherwise copy and specialize the P2P configuration
services := make(map[reflect.Type]Service) services := make(map[reflect.Type]Service)