Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
[GH-32] 64.0 becomes 64 if int
Browse files Browse the repository at this point in the history
  • Loading branch information
030 committed Dec 12, 2018
1 parent df5ecfd commit 287700e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (i input) value() string {
if err != nil {
panic(fmt.Errorf("fatal error config file: %s", err))
}
value := fmt.Sprintf("%s", viper.Get(keyWithoutFirstDot))
value := fmt.Sprintf("%v", viper.Get(keyWithoutFirstDot))

if value == "%!s(<nil>)" {
log.Fatal("File: ", i.file, " does not contain key: ", i.key)
Expand Down
14 changes: 10 additions & 4 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ firefox_checksum: sha512:49d776
hello:
world: hallo wereld
world: [hola, hallo]
firefox_version: 64.0
firefox_version4: 64
firefox_version3: 64.1
firefox_version2: "64.0"
firefox_version: 64.0.0
`

type T struct {
Expand Down Expand Up @@ -79,9 +82,12 @@ func TestYamlValue(t *testing.T) {
".foo.bar": "boo",
".services.db.image": "someimage",
".services.db.environment.MYSQL_ROOT_PASSWORD": "somewordpress",
".world": "[hola hallo]",
".hello.world": "hallo wereld",
".firefox_version": "64.0",
".world": "[hola hallo]",
".hello.world": "hallo wereld",
".firefox_version4": "64",
".firefox_version3": "64.1",
".firefox_version2": "64.0",
".firefox_version": "64.0.0",
}

for key, value := range keyValue {
Expand Down

0 comments on commit 287700e

Please sign in to comment.