fix linting issues

This commit is contained in:
Huiyi Li 2020-04-06 19:04:47 -07:00
parent 18575fb554
commit cd6be44f06
4 changed files with 11 additions and 7 deletions

View file

@ -26,17 +26,19 @@ import (
_ "github.com/mattn/go-sqlite3"
)
const foo = "foo"
func TestKeyStoreDB(t *testing.T) {
ks := tmpKeyStoreDB(t)
acc, err := ks.NewAccount("foo")
acc, err := ks.NewAccount(foo)
if err != nil {
t.Fatal(err)
}
if !ks.HasAddress(acc.Address) {
t.Errorf("HasAccount(%x) should've returned true", acc.Address)
}
if err := ks.Update(acc, "foo", "bar"); err != nil {
if err := ks.Update(acc, foo, "bar"); err != nil {
t.Errorf("Update error: %v", err)
}
if err := ks.Delete(acc, "bar"); err != nil {
@ -93,7 +95,7 @@ func TestSignWithPassphraseDB(t *testing.T) {
func TestTimedUnlockDB(t *testing.T) {
ks := tmpKeyStoreDB(t)
pass := "foo"
pass := foo
acc, err := ks.NewAccount(pass)
if err != nil {
t.Fatal(err)
@ -127,7 +129,7 @@ func TestTimedUnlockDB(t *testing.T) {
func TestOverrideUnlockDB(t *testing.T) {
ks := tmpKeyStoreDB(t)
pass := "foo"
pass := foo
acc, err := ks.NewAccount(pass)
if err != nil {
t.Fatal(err)

View file

@ -81,7 +81,7 @@ func readConfigYAML(path string) (*DBConf, error) {
}
conf := &DBConf{}
if err = yaml.Unmarshal([]byte(yamlContent), conf); err != nil {
if err = yaml.Unmarshal(yamlContent, conf); err != nil {
log.Warn("Cannot parse yaml config: ", err)
return nil, err
}

View file

@ -503,7 +503,6 @@ func signer(c *cli.Context) error {
var (
api core.ExternalAPI
pwStorage storage.Storage = storage.NewNoStorage()
jsStorage storage.Storage = storage.NewNoStorage()
configStorage storage.Storage = storage.NewNoStorage()
)
configDir := c.GlobalString(configdirFlag.Name)
@ -512,7 +511,7 @@ func signer(c *cli.Context) error {
} else {
// create dedicated storages for different type of configuration
pwStorage = initPasswordStorage(stretchedKey, c)
jsStorage = initJsStorage(stretchedKey, c)
jsStorage := initJsStorage(stretchedKey, c)
configStorage = initConfigStorage(stretchedKey, c)
// Do we have a rule-file?

View file

@ -76,6 +76,9 @@ func TestEnd2End(t *testing.T) {
// make sure intermediate result is encrypted correctly
encrypted, err := fs.api.Get("bazonk")
if err != nil {
t.Error("Failed to retrieve encrypted credential")
}
cred := StoredCredential{}
if err = json.Unmarshal([]byte(encrypted), &cred); err != nil {
t.Error("Failed to unmarshal encrypted credential", "err", err)