-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path02-spec-file-processor.go
More file actions
53 lines (37 loc) · 903 Bytes
/
Copy path02-spec-file-processor.go
File metadata and controls
53 lines (37 loc) · 903 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"bufio"
"os"
)
const idBase = 62
const idLength = 22
func specFileProcessor(context context) {
context.enterStage("02 spec-file-processor")
defer context.WaitGroup.Done()
osFile, err := os.Open(context.Pathname)
if errorHandler(&context, err) {
context.ResultGathererChannel <- context
return
}
randomID, err := newRandom(&context)
if errorHandler(&context, err) {
context.ResultGathererChannel <- context
return
}
context.ID = randomID
context.File = &file{
bufio.NewReader(osFile),
context.Pathname,
osFile,
0,
}
context.Substitutions = map[string]string{}
context.Substitutions["YYYY-MM-DD"] = context.StartedAt.UTC().Format("2006-01-02")
context.Substitutions["random-uuid"] = randomID
context.HTTPClient = newHTTPClient(
context.SkipTLSVerification,
context.HTTPTimeout,
)
specTripletIterator(&context)
osFile.Close()
}