Skip to content
This repository has been archived by the owner on Apr 2, 2018. It is now read-only.

Commit

Permalink
Removes candiedyaml in favor of goyaml
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgersh committed Apr 6, 2015
1 parent 28030b8 commit f2cf940
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
15 changes: 7 additions & 8 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package blackbox

import (
"fmt"
"io/ioutil"
"os"
"time"

"github.com/cloudfoundry-incubator/candiedyaml"

"github.com/concourse/blackbox/syslog"
"gopkg.in/yaml.v2"
)

type Duration time.Duration
Expand Down Expand Up @@ -54,9 +54,9 @@ type DatadogConfig struct {
}

type ExpvarConfig struct {
Interval Duration `yaml: "interval"`
Datadog DatadogConfig `yaml: "datadog"`
Sources []ExpvarSource `yaml: "sources"`
Interval Duration `yaml:"interval"`
Datadog DatadogConfig `yaml:"datadog"`
Sources []ExpvarSource `yaml:"sources"`
}

type Config struct {
Expand All @@ -67,15 +67,14 @@ type Config struct {
}

func LoadConfig(path string) (*Config, error) {
configFile, err := os.Open(path)
configFile, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
defer configFile.Close()

var config Config

if err := candiedyaml.NewDecoder(configFile).Decode(&config); err != nil {
if err := yaml.Unmarshal(configFile, &config); err != nil {
return nil, err
}

Expand Down
6 changes: 4 additions & 2 deletions integration/blackbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"os/exec"

. "github.com/onsi/gomega"
"gopkg.in/yaml.v2"

"github.com/cloudfoundry-incubator/candiedyaml"
"github.com/tedsuo/ifrit"
"github.com/tedsuo/ifrit/ginkgomon"
"github.com/ziutek/syslog"
Expand Down Expand Up @@ -110,8 +110,10 @@ func (runner *BlackboxRunner) createConfigFile(config blackbox.Config) string {
Ω(err).ShouldNot(HaveOccurred())
defer configFile.Close()

err = candiedyaml.NewEncoder(configFile).Encode(config)
yamlToWrite, err := yaml.Marshal(config)
Ω(err).ShouldNot(HaveOccurred())

configFile.Write(yamlToWrite)

return configFile.Name()
}

0 comments on commit f2cf940

Please sign in to comment.