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

Commit

Permalink
Merge pull request #33 from 030/32-float-issue
Browse files Browse the repository at this point in the history
[GH-32] dependency management
  • Loading branch information
030 authored Dec 12, 2018
2 parents dc356e5 + 287700e commit dae0e11
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
*.out

go-yq*
test.yaml
test.yaml

vendor
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
language: go
script:
- go test
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- dep ensure -update
- go test ./... -cover
- wget https://gist.githubusercontent.com/030/da7c28869ae69fc4c02634e253ab615b/raw/43df4fbbff30d6e065e0de1270e5ee9ad0803bb7/go-releases.sh
- chmod +x ./go-releases.sh
- ./go-releases.sh yq
Expand Down
137 changes: 137 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/spf13/viper"
version = "1.3.1"

[[constraint]]
name = "gopkg.in/yaml.v2"
version = "2.2.2"

[prune]
go-tests = true
unused-packages = true
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
12 changes: 10 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ firefox_checksum: sha512:49d776
hello:
world: hallo wereld
world: [hola, hallo]
firefox_version4: 64
firefox_version3: 64.1
firefox_version2: "64.0"
firefox_version: 64.0.0
`

type T struct {
Expand Down Expand Up @@ -78,8 +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",
".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 dae0e11

Please sign in to comment.