Skip to content
Permalink
Browse files

add machineId dep

  • Loading branch information
mlapshin committed Sep 26, 2018
1 parent 5652790 commit 89054103499bc385fb4b5d1ff131cfcbdc74408f
Showing with 49 additions and 5 deletions.
  1. +11 −1 Gopkg.lock
  2. +5 −4 main.go
  3. +9 −0 stats.go
  4. +24 −0 stats_test.go

Some generated files are not rendered by default. Learn more.

@@ -2,7 +2,6 @@ package main

import (
"fmt"
"log"
"os"
"strings"

@@ -174,13 +173,15 @@ func main() {
}

app.ExitErrHandler = func(context *cli.Context, err error) {
fmt.Printf("%+v\n", err)
os.Exit(1)
if err != nil {
fmt.Printf("%+v\n", err)
os.Exit(1)
}
}

err := app.Run(os.Args)

if err != nil {
log.Fatal(err)
fmt.Printf("%+v\n", err)
}
}
@@ -0,0 +1,9 @@
package main

import (
"github.com/denisbrodbeck/machineid"
)

func getMachineID() (string, error) {
return machineid.ProtectedID("fhirbase")
}
@@ -0,0 +1,24 @@
package main

import (
"testing"
)

func TestMachineId(t *testing.T) {
firstId, err := getMachineID()

if err != nil {
t.Error(err)
}

secondId, err := getMachineID()

if err != nil {
t.Error(err)
}

if firstId != secondId {
t.Log("Expected to get two identical machine IDs, got different")
t.Fail()
}
}

0 comments on commit 8905410

Please sign in to comment.
You can’t perform that action at this time.