Skip to content

Commit

Permalink
repository name changes added
Browse files Browse the repository at this point in the history
  • Loading branch information
wgarunap committed Feb 13, 2020
1 parent e4667fb commit 770e5bc
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Config
# Go Config
Library to load env configuration

### How to use it
Expand All @@ -13,7 +13,7 @@ var Config Conf
func (Conf) Register() {
err := env.Parse(&Config)
if err != nil {
log.Fatal("error loading stream config, ", err)
log.Fatal("error loading stream goconf, ", err)
}
}

Expand Down
12 changes: 8 additions & 4 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"github.com/caarlos0/env"
"github.com/pickme-go/log/v2"
"github.com/wgarunap/config"
"github.com/wgarunap/goconf"
"os"
)

Expand All @@ -16,7 +16,7 @@ var Config Conf
func (Conf) Register() {
err := env.Parse(&Config)
if err != nil {
log.Fatal("error loading stream config, ", err)
log.Fatal("error loading stream goconf, ", err)
}
}

Expand All @@ -33,9 +33,13 @@ func (Conf) Print() interface{} {
func main() {
_ = os.Setenv("MY_NAME", "My First Configuration")

config.Load(
goconf.Load(
new(Conf),
)

log.Info(`config successfully loaded`)
if Config.Name != `My First Configuration` {
log.Fatal(`error while comparing config`)
}

log.Info(`goconf successfully loaded`)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/wgarunap/config
module github.com/wgarunap/goconf

go 1.13

Expand Down
29 changes: 29 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
github.com/caarlos0/env v3.5.0+incompatible h1:Yy0UN8o9Wtr/jGHZDpCBLpNrzcFLLM2yixi/rBrKyJs=
github.com/caarlos0/env v3.5.0+incompatible/go.mod h1:tdCsowwCzMLdkqRYDlHpZCp2UooDD3MspDBjZ2AD02Y=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/logrusorgru/aurora v0.0.0-20191017060258-dc85c304c434 h1:im9kkmH0WWwxzegiv18gSUJbuXR9y028rXrWuPp6Jug=
github.com/logrusorgru/aurora v0.0.0-20191017060258-dc85c304c434/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/oleiade/reflections v1.0.0 h1:0ir4pc6v8/PJ0yw5AEtMddfXpWBXg9cnG7SgSoJuCgY=
github.com/oleiade/reflections v1.0.0/go.mod h1:RbATFBbKYkVdqmSFtx13Bb/tVhR0lgOBXunWTZKeL4w=
github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8=
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
github.com/pickme-go/log/v2 v2.0.1 h1:icYwqQ/W8Zi+IeLlc+4eG6FblwtpEAV/ZFnvlIys4+s=
github.com/pickme-go/log/v2 v2.0.1/go.mod h1:GKHJGQBd2aw/DiR01IdNff8+nsbaJPoTmvavqIg5Kgk=
github.com/pickme-go/traceable-context v1.0.0 h1:q9ZOf0MZIIzgwi2YKx5MOP++2vxlqZFck4XZxZubIwk=
github.com/pickme-go/traceable-context v1.0.0/go.mod h1:di3UG7gaOYqVRF3Q67+6ThEfIQvbebinon0tj+Epiuk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/oleiade/reflections.v1 v1.0.0 h1:nV9NFaFd5bXKjilVvPvA+/V/tNQk1pOEEc9gGWDkj+s=
gopkg.in/oleiade/reflections.v1 v1.0.0/go.mod h1:SpA8pv+LUnF0FbB2hyRxc8XSng78D6iLBZ11PDb8Z5g=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
4 changes: 2 additions & 2 deletions register.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package goconf

import (
"fmt"
Expand Down Expand Up @@ -46,7 +46,7 @@ func printTable(p Printer) {
for _, field := range fields {
value, err := reflections.GetField(pr, field)
if err != nil {
log.Error("error printing the config table", err)
log.Error("error printing the goconf table", err)
}
data = append(data, []string{field, fmt.Sprint(value)})
}
Expand Down

0 comments on commit 770e5bc

Please sign in to comment.