Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"regexp"
"github.com/concourse/atc"
"gopkg.in/yaml.v2"
)
func main() {
in, err := ioutil.ReadAll(os.Stdin)
if err != nil {
log.Fatalln("Read error:", err)
}
varPlaceholder := regexp.MustCompile(`\{\{.+\}\}`)
in = varPlaceholder.ReplaceAll(in, []byte("VARIABLE"))
var config atc.Config
err = yaml.Unmarshal(in, &config)
if err != nil {
log.Fatalln("Unmarshall error:", err)
}
out, err := yaml.Marshal(&config)
if err != nil {
log.Fatalln("Marshall error:", err)
}
fmt.Println(string(out))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.