aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-25 22:58:52 +0800
committerzelig <viktor.tron@gmail.com>2015-03-27 03:00:18 +0800
commit4ec38e39320ee9abccd96da765a9c65fccd04151 (patch)
tree3f57aebae8bd42f766b80a3db5e3b22328e9a181 /cmd
parent23e41a57ad7e7cb4bc5a1cbad28bbf8d65907fdd (diff)
downloaddexon-4ec38e39320ee9abccd96da765a9c65fccd04151.tar
dexon-4ec38e39320ee9abccd96da765a9c65fccd04151.tar.gz
dexon-4ec38e39320ee9abccd96da765a9c65fccd04151.tar.bz2
dexon-4ec38e39320ee9abccd96da765a9c65fccd04151.tar.lz
dexon-4ec38e39320ee9abccd96da765a9c65fccd04151.tar.xz
dexon-4ec38e39320ee9abccd96da765a9c65fccd04151.tar.zst
dexon-4ec38e39320ee9abccd96da765a9c65fccd04151.zip
common: remove WriteFile and ReadAllFile (use ioutil instead)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ethereum/js_test.go6
-rw-r--r--cmd/ethereum/main.go5
-rw-r--r--cmd/mist/bindings.go7
-rw-r--r--cmd/mist/gui.go5
4 files changed, 13 insertions, 10 deletions
diff --git a/cmd/ethereum/js_test.go b/cmd/ethereum/js_test.go
index 580bc7a2b..5b962f621 100644
--- a/cmd/ethereum/js_test.go
+++ b/cmd/ethereum/js_test.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+ "io/ioutil"
"os"
"path"
"testing"
@@ -9,7 +10,6 @@ import (
"github.com/robertkrimen/otto"
"github.com/ethereum/go-ethereum/accounts"
- "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
)
@@ -30,8 +30,8 @@ func testJEthRE(t *testing.T) (repl *jsre, ethereum *eth.Ethereum, err error) {
}
// FIXME: this does not work ATM
ks := crypto.NewKeyStorePlain("/tmp/eth/keys")
- common.WriteFile("/tmp/eth/keys/e273f01c99144c438695e10f24926dc1f9fbf62d/e273f01c99144c438695e10f24926dc1f9fbf62d",
- []byte(`{"Id":"RhRXD+fNRKS4jx+7ZfEsNA==","Address":"4nPwHJkUTEOGleEPJJJtwfn79i0=","PrivateKey":"h4ACVpe74uIvi5Cg/2tX/Yrm2xdr3J7QoMbMtNX2CNc="}`))
+ ioutil.WriteFile("/tmp/eth/keys/e273f01c99144c438695e10f24926dc1f9fbf62d/e273f01c99144c438695e10f24926dc1f9fbf62d",
+ []byte(`{"Id":"RhRXD+fNRKS4jx+7ZfEsNA==","Address":"4nPwHJkUTEOGleEPJJJtwfn79i0=","PrivateKey":"h4ACVpe74uIvi5Cg/2tX/Yrm2xdr3J7QoMbMtNX2CNc="}`), os.ModePerm)
port++
ethereum, err = eth.New(&eth.Config{
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index 57729b206..6bbe1044f 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -355,10 +355,11 @@ func getPassPhrase(ctx *cli.Context, desc string, confirmation bool) (passphrase
passphrase = auth
} else {
- var err error
- if passphrase, err = common.ReadAllFile(passfile); err != nil {
+ passbytes, err := ioutil.ReadFile(passfile)
+ if err != nil {
utils.Fatalf("Unable to read password file '%s': %v", passfile, err)
}
+ passphrase = string(passbytes)
}
}
return
diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go
index 8a9ec7cb1..e7ce50c35 100644
--- a/cmd/mist/bindings.go
+++ b/cmd/mist/bindings.go
@@ -22,13 +22,14 @@ package main
import (
"encoding/json"
+ "io/ioutil"
"os"
"strconv"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/state"
+ "github.com/ethereum/go-ethereum/core/types"
)
type plugin struct {
@@ -46,14 +47,14 @@ func (self *Gui) AddPlugin(pluginPath string) {
self.plugins[pluginPath] = plugin{Name: pluginPath, Path: pluginPath}
json, _ := json.MarshalIndent(self.plugins, "", " ")
- common.WriteFile(self.eth.DataDir+"/plugins.json", json)
+ ioutil.WriteFile(self.eth.DataDir+"/plugins.json", json, os.ModePerm)
}
func (self *Gui) RemovePlugin(pluginPath string) {
delete(self.plugins, pluginPath)
json, _ := json.MarshalIndent(self.plugins, "", " ")
- common.WriteFile(self.eth.DataDir+"/plugins.json", json)
+ ioutil.WriteFile(self.eth.DataDir+"/plugins.json", json, os.ModePerm)
}
func (self *Gui) DumpState(hash, path string) {
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go
index 08f02f833..d37d6f81b 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -25,6 +25,7 @@ import "C"
import (
"encoding/json"
"fmt"
+ "io/ioutil"
"math/big"
"path"
"runtime"
@@ -91,8 +92,8 @@ func NewWindow(ethereum *eth.Ethereum) *Gui {
plugins: make(map[string]plugin),
serviceEvents: make(chan ServEv, 1),
}
- data, _ := common.ReadAllFile(path.Join(ethereum.DataDir, "plugins.json"))
- json.Unmarshal([]byte(data), &gui.plugins)
+ data, _ := ioutil.ReadFile(path.Join(ethereum.DataDir, "plugins.json"))
+ json.Unmarshal(data, &gui.plugins)
return gui
}