File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ Ape ate Apple000002 at 1234.56 - true2
4
4
Ape ate Apple000003 at 1234.56 - true3
5
5
Ape ate Apple000004 at 1234.56 - true4
6
6
Ape ate Apple000005 at 1234.56 - true5
7
+ Ape ate Apple000000 at 1234.56 - true0
8
+ Ape ate Apple000001 at 1234.56 - true1
9
+ Ape ate Apple000002 at 1234.56 - true2
7
10
Ape ate Apple001001 at 1234.56 - true1001
8
11
Ape ate Apple001002 at 1234.56 - true1002
9
12
Ape ate Apple001003 at 1234.56 - true1003
Original file line number Diff line number Diff line change 1
1
{{- define "T1"}}Apple{{.i}} at {{.c.Price}} - {{.c.Shipped}}{{end}} {{- define "T2"}}Ape{{end}}
2
- {{- range $val := iterate 5 }}
2
+ {{- range $val := iterate "5" }}
3
3
{{- template "T2"}} ate {{template "T1" argsm "c" $ "i" (printf "%06d" $val)}}{{ $val }}
4
4
{{end }}
5
- {{- range $val := iterate 1003 1001 }}
5
+ {{- range $val := iterate "2" (ENV "__START") }}
6
+ {{- template "T2"}} ate {{template "T1" argsm "c" $ "i" (printf "%06d" $val)}}{{ $val }}
7
+ {{end }}
8
+ {{- range $val := iterate "1003" "1001" }}
6
9
{{- template "T2"}} ate {{template "T1" argsm "c" $ "i" (printf "%06d" $val)}}{{ $val }}
7
10
{{end }}
Original file line number Diff line number Diff line change @@ -2,17 +2,19 @@ package easygen
2
2
3
3
import (
4
4
"errors"
5
+ "strconv"
5
6
)
6
7
7
8
//==========================================================================
8
9
// template function somewhat related to calculations
9
10
10
11
// Iterate returns a slice whose end (& start) is controlled by the ic
11
- func Iterate (ic ... int ) []int {
12
- end := ic [0 ]
12
+ func Iterate (ic ... string ) []int {
13
+ // cannot think of a better way to report the Atoi error, other than --
14
+ end , _ := strconv .Atoi (ic [0 ])
13
15
start := 0
14
16
if len (ic ) > 1 {
15
- start = ic [1 ]
17
+ start , _ = strconv . Atoi ( ic [1 ])
16
18
}
17
19
var Items []int
18
20
for i := start ; i <= (end ); i ++ {
You can’t perform that action at this time.
0 commit comments