Skip to content

Commit

Permalink
Fix output of build info on start
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Jan 29, 2020
1 parent 0b17b15 commit d030716
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 28 deletions.
5 changes: 5 additions & 0 deletions cmd/dmsgpty/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/spf13/cobra"

"github.com/SkycoinProject/skywire-mainnet/internal/skyenv"
"github.com/SkycoinProject/skywire-mainnet/pkg/buildinfo"
"github.com/SkycoinProject/skywire-mainnet/pkg/dmsgpty"
)

Expand All @@ -32,6 +33,10 @@ var rootCmd = &cobra.Command{
Use: "dmsgpty",
Short: "Run commands over dmsg",
PreRunE: func(*cobra.Command, []string) error {
if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

return readDstAddr()
},
RunE: func(*cobra.Command, []string) error {
Expand Down
7 changes: 0 additions & 7 deletions cmd/dmsgpty/dmsgpty.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
package main

import (
"log"

"github.com/SkycoinProject/skywire-mainnet/cmd/dmsgpty/commands"
"github.com/SkycoinProject/skywire-mainnet/pkg/buildinfo"
)

func main() {
if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

commands.Execute()
}
6 changes: 6 additions & 0 deletions cmd/hypervisor/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package commands
import (
"fmt"
"net/http"
"os"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/disc"

"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/spf13/cobra"

"github.com/SkycoinProject/skywire-mainnet/pkg/buildinfo"
"github.com/SkycoinProject/skywire-mainnet/pkg/hypervisor"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/pathutil"
)
Expand Down Expand Up @@ -43,6 +45,10 @@ var rootCmd = &cobra.Command{
Use: "hypervisor",
Short: "Manages Skywire App Nodes",
Run: func(_ *cobra.Command, args []string) {
if _, err := buildinfo.Get().WriteTo(os.Stdout); err != nil {
log.Printf("Failed to output build info: %v", err)
}

if configPath == "" {
configPath = pathutil.FindConfigPath(args, -1, configEnv, pathutil.HypervisorDefaults())
}
Expand Down
7 changes: 0 additions & 7 deletions cmd/hypervisor/hypervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,9 @@ skywire hypervisor
package main

import (
"log"

"github.com/SkycoinProject/skywire-mainnet/cmd/hypervisor/commands"
"github.com/SkycoinProject/skywire-mainnet/pkg/buildinfo"
)

func main() {
if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

commands.Execute()
}
4 changes: 4 additions & 0 deletions cmd/setup-node/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
logrussyslog "github.com/sirupsen/logrus/hooks/syslog"
"github.com/spf13/cobra"

"github.com/SkycoinProject/skywire-mainnet/pkg/buildinfo"
"github.com/SkycoinProject/skywire-mainnet/pkg/metrics"
"github.com/SkycoinProject/skywire-mainnet/pkg/setup"
)
Expand All @@ -29,6 +30,9 @@ var rootCmd = &cobra.Command{
Use: "setup-node [config.json]",
Short: "Route Setup Node for skywire",
Run: func(_ *cobra.Command, args []string) {
if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

logger := logging.MustGetLogger(tag)
if syslogAddr != "" {
Expand Down
7 changes: 0 additions & 7 deletions cmd/setup-node/setup-node.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
package main

import (
"log"

"github.com/SkycoinProject/skywire-mainnet/cmd/setup-node/commands"
"github.com/SkycoinProject/skywire-mainnet/pkg/buildinfo"
)

func main() {
if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

commands.Execute()
}
4 changes: 4 additions & 0 deletions cmd/skywire-visor/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ var rootCmd = &cobra.Command{
Use: "skywire-visor [config-path]",
Short: "Visor for skywire",
Run: func(_ *cobra.Command, args []string) {
if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

cfg.args = args

cfg.startProfiler().
Expand Down
7 changes: 0 additions & 7 deletions cmd/skywire-visor/skywire-visor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,9 @@ skywire visor
package main

import (
"log"

"github.com/SkycoinProject/skywire-mainnet/cmd/skywire-visor/commands"
"github.com/SkycoinProject/skywire-mainnet/pkg/buildinfo"
)

func main() {
if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

commands.Execute()
}

0 comments on commit d030716

Please sign in to comment.