feat: use viper and cobra to parameterize creation values with viper yaml
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/gob"
|
||||
"log"
|
||||
"os/exec"
|
||||
"strings"
|
||||
@@ -16,3 +18,13 @@ func RootDir() string {
|
||||
rootDir := strings.TrimSpace(string(cmdOut))
|
||||
return rootDir
|
||||
}
|
||||
|
||||
func GetBytes(key interface{}) ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
enc := gob.NewEncoder(&buf)
|
||||
err := enc.Encode(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user