Commit 639d196a authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

linted config

parent 80323eba
......@@ -45,7 +45,7 @@ func init() {
func configCmd(c *commander.Command, inp []string) error {
// todo: implement --config filename flag.
filename, err := config.ConfigFilename("")
filename, err := config.Filename("")
if err != nil {
return err
}
......@@ -103,8 +103,11 @@ func configCat(filename string) error {
}
defer file.Close()
_, err = io.Copy(os.Stdout, file)
return err
if _, err = io.Copy(os.Stdout, file); err != nil {
return err
}
u.POut("\n")
return nil
}
func configEditor(filename string) error {
......
......@@ -67,7 +67,7 @@ func main() {
func localNode() (*core.IpfsNode, error) {
//todo implement config file flag
cfg, err := config.ConfigLoad("")
cfg, err := config.Load("")
if err != nil {
return nil, err
}
......
......@@ -32,8 +32,8 @@ var defaultConfigFile = `{
}
`
// ConfigFilename returns the proper tilde expanded config filename.
func ConfigFilename(filename string) (string, error) {
// Filename returns the proper tilde expanded config filename.
func Filename(filename string) (string, error) {
if len(filename) == 0 {
filename = defaultConfigFilePath
}
......@@ -42,9 +42,9 @@ func ConfigFilename(filename string) (string, error) {
return u.TildeExpansion(filename)
}
// ConfigLoad reads given file and returns the read config, or error.
func ConfigLoad(filename string) (*Config, error) {
filename, err := ConfigFilename(filename)
// Load reads given file and returns the read config, or error.
func Load(filename string) (*Config, error) {
filename, err := Filename(filename)
if err != nil {
return nil, err
}
......
......@@ -7,7 +7,7 @@ import (
func TestConfig(t *testing.T) {
cfg, err := ConfigLoad("")
cfg, err := Load("")
if err != nil {
t.Error(err)
return
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment