Skip to content

Commit

Permalink
config: remove unused Default() method
Browse files Browse the repository at this point in the history
  • Loading branch information
fern4lvarez committed Feb 17, 2017
1 parent c313506 commit 5cdc26c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
9 changes: 0 additions & 9 deletions config/config.go
Expand Up @@ -3,7 +3,6 @@ package config
import (
"time"

"github.com/fern4lvarez/piladb/config/vars"
"github.com/fern4lvarez/piladb/pila"
"github.com/fern4lvarez/piladb/pkg/uuid"
)
Expand All @@ -24,14 +23,6 @@ func NewConfig() *Config {
return &Config{Values: pila.NewDatabase(CONFIG)}
}

// Default sets the default values to the Config.
func (c *Config) Default() *Config {
// Infinite size
c.Set(vars.MaxStackSize, -1)

return c
}

// Get gets a config value from a key.
func (c *Config) Get(key string) interface{} {
s, ok := c.Values.Stacks[uuid.New(CONFIG+key)]
Expand Down
16 changes: 0 additions & 16 deletions config/config_test.go
Expand Up @@ -5,7 +5,6 @@ import (
"testing"
"time"

"github.com/fern4lvarez/piladb/config/vars"
"github.com/fern4lvarez/piladb/pkg/uuid"
)

Expand All @@ -31,21 +30,6 @@ func TestNewConfig(t *testing.T) {
}
}

func TestConfigDefault(t *testing.T) {
config := NewConfig().Default()
inputOutput := []struct {
input string
output interface{}
}{
{vars.MaxStackSize, -1},
}
for _, io := range inputOutput {
if value := config.Get(io.input); value != io.output {
t.Errorf("Values is %v, expected %v", value, io.output)
}
}
}

func TestConfigGet(t *testing.T) {
config := NewConfig()

Expand Down
2 changes: 1 addition & 1 deletion pilad/conn.go
Expand Up @@ -28,7 +28,7 @@ type Conn struct {
func NewConn() *Conn {
conn := &Conn{}
conn.Pila = pila.NewPila()
conn.Config = config.NewConfig().Default()
conn.Config = config.NewConfig()
conn.Status = NewStatus(version.Version(version.VERSION), time.Now().UTC(), MemStats())
return conn
}
Expand Down

0 comments on commit 5cdc26c

Please sign in to comment.