MCPcopy Index your code
hub / github.com/jwilder/dockerize / loop

Function loop

template.go:102–124  ·  view source on GitHub ↗
(args ...int)

Source from the content-addressed store, hash-verified

100}
101
102func loop(args ...int) (<-chan int, error) {
103 var start, stop, step int
104 switch len(args) {
105 case 1:
106 start, stop, step = 0, args[0], 1
107 case 2:
108 start, stop, step = args[0], args[1], 1
109 case 3:
110 start, stop, step = args[0], args[1], args[2]
111 default:
112 return nil, fmt.Errorf("wrong number of arguments, expected 1-3"+
113 ", but got %d", len(args))
114 }
115
116 c := make(chan int)
117 go func() {
118 for i := start; i < stop; i += step {
119 c <- i
120 }
121 close(c)
122 }()
123 return c, nil
124}
125
126func generateFile(templatePath, destPath string) bool {
127 templateMap := template.FuncMap{

Callers 1

TestLoopFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestLoopFunction · 0.68