Skip to content

Commit

Permalink
Merge pull request #126 from davrodpin/fix-init-dup
Browse files Browse the repository at this point in the history
Remove duplication of log and memguard init.
  • Loading branch information
davrodpin authored Aug 31, 2020
2 parents ec7692f + f2472de commit b992df5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ var (

// Execute executes the root command
func Execute() error {
// memguard is used to securely keep sensitive information in memory.
// This call makes sure all data will be destroy when the program exits.
defer memguard.Purge()

log.SetOutput(os.Stdout)

return rootCmd.Execute()
Expand Down Expand Up @@ -64,6 +60,10 @@ provide 0 to never give up or a negative number to disable`)
}

func start(id string, tunnelFlags *alias.TunnelFlags) {
// memguard is used to securely keep sensitive information in memory.
// This call makes sure all data will be destroy when the program exits.
defer memguard.Purge()

if tunnelFlags.Detach {
var err error

Expand Down
9 changes: 0 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,9 @@ import (
"os"

"github.com/davrodpin/mole/cmd"

"github.com/awnumar/memguard"
log "github.com/sirupsen/logrus"
)

func main() {
// memguard is used to securely keep sensitive information in memory.
// This call makes sure all data will be destroy when the program exits.
defer memguard.Purge()

log.SetOutput(os.Stdout)

err := cmd.Execute()
if err != nil {
os.Exit(1)
Expand Down

0 comments on commit b992df5

Please sign in to comment.