-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.go
More file actions
38 lines (29 loc) · 758 Bytes
/
process.go
File metadata and controls
38 lines (29 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"fmt"
"io/ioutil"
)
func processBytes(byteArray []byte, output *string) (string, error) {
//preflight with optional conversion from YAMLs
err := preflightAsset(&byteArray)
if err != nil {
return "", fmt.Errorf("input failed preflight check: %v", err)
}
// make sure config objects are presented as a list
err = makeList(&byteArray)
if err != nil {
return "", err
}
return "", nil
}
func processFile(path string, output *string) (string, error) {
byteArray, err := ioutil.ReadFile(path)
if err != nil {
return "", fmt.Errorf("can't read %s: %v", path, err)
}
result, err := processBytes(byteArray, output)
if err != nil {
return "", fmt.Errorf("can't process %s: %s", path, err)
}
return result, nil
}