Skip to content

Commit

Permalink
changed method of getting homedir to help cross compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nik Ogura committed Jun 25, 2018
1 parent 97d1239 commit 7d08a65
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cmd/dbt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
const DBT = "/usr/local/bin/dbt"

// VERSION the version of dbt. Must match version in metadata.json
const VERSION = "2.1.1"
const VERSION = "2.1.2"

// there are only two options for dbt itself, 'version' and 'offline'
var version string
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.1.1",
"version": "2.1.2",
"package": "github.com/nikogura/dbt",
"description": "Dynamic Binary Toolkit - A framework for running self-updating signed binaries from a central, trusted repository.",
"repository": "http://localhost:8081/artifactory/dbt",
Expand Down
20 changes: 4 additions & 16 deletions pkg/dbt/dbt.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package dbt
import (
"encoding/json"
"fmt"
"github.com/mitchellh/go-homedir"
"github.com/pkg/errors"
"io/ioutil"
"log"
"net/http"
"os"
"os/user"
"runtime"
"syscall"
)
Expand Down Expand Up @@ -157,21 +157,9 @@ func GenerateDbtDir(homedir string, verbose bool) (err error) {
}

// GetHomeDir get's the current user's homedir
func GetHomeDir() (homedir string, err error) {
userObj, err := user.Current()
if err != nil {
err = errors.Wrapf(err, "failed to get current user")
return homedir, err
}

homedir = userObj.HomeDir

if homedir == "" {
err = fmt.Errorf("no homedir for user %q", userObj.Username)
return homedir, err
}

return homedir, err
func GetHomeDir() (dir string, err error) {
dir, err = homedir.Dir()
return dir, err
}

// FetchTrustStore writes the downloaded trusted signing public keys to disk.
Expand Down

0 comments on commit 7d08a65

Please sign in to comment.