@@ -30,15 +30,15 @@ const (
30
30
githubRawURL = "https://raw.githubusercontent.com/"
31
31
)
32
32
33
- type Source struct {
33
+ type source struct {
34
34
Content io.ReadCloser
35
35
Remote bool
36
36
Path string
37
37
Name string
38
38
File string
39
39
}
40
40
41
- func (s * Source ) String () string {
41
+ func (s * source ) String () string {
42
42
if s .Path == "" && s .Name == "" {
43
43
return ""
44
44
}
@@ -55,7 +55,7 @@ func openFile(path string) (io.ReadCloser, bool, error) {
55
55
return f , true , nil
56
56
}
57
57
58
- func loadLocal (base * Source , name string ) (* Source , bool , error ) {
58
+ func loadLocal (base * source , name string ) (* source , bool , error ) {
59
59
path := filepath .Join (base .Path , name )
60
60
61
61
content , ok , err := openFile (path )
@@ -66,7 +66,7 @@ func loadLocal(base *Source, name string) (*Source, bool, error) {
66
66
}
67
67
log .Debugf ("opened %s" , path )
68
68
69
- return & Source {
69
+ return & source {
70
70
Content : content ,
71
71
Remote : false ,
72
72
Path : filepath .Dir (path ),
@@ -95,7 +95,7 @@ func githubURL(urlName string) (string, bool) {
95
95
return url , true
96
96
}
97
97
98
- func loadURL (ctx context.Context , base * Source , name string ) (* Source , bool , error ) {
98
+ func loadURL (ctx context.Context , base * source , name string ) (* source , bool , error ) {
99
99
url := name
100
100
if base .Path != "" {
101
101
url = base .Path + "/" + name
@@ -129,7 +129,7 @@ func loadURL(ctx context.Context, base *Source, name string) (*Source, bool, err
129
129
pathURL := * parsed
130
130
pathURL .Path = filepath .Dir (parsed .Path )
131
131
132
- return & Source {
132
+ return & source {
133
133
Content : resp .Body ,
134
134
Remote : true ,
135
135
Path : pathURL .String (),
@@ -174,7 +174,7 @@ func loadProgram(data []byte, into *types.Program, targetToolName string) (types
174
174
return tool , nil
175
175
}
176
176
177
- func ReadTool (ctx context.Context , prg * types.Program , base * Source , targetToolName string ) (types.Tool , error ) {
177
+ func readTool (ctx context.Context , prg * types.Program , base * source , targetToolName string ) (types.Tool , error ) {
178
178
data , err := io .ReadAll (base .Content )
179
179
if err != nil {
180
180
return types.Tool {}, err
@@ -270,7 +270,7 @@ func pickToolName(toolName string, existing map[string]struct{}) string {
270
270
}
271
271
}
272
272
273
- func link (ctx context.Context , prg * types.Program , base * Source , tool types.Tool , localTools types.ToolSet ) (types.Tool , error ) {
273
+ func link (ctx context.Context , prg * types.Program , base * source , tool types.Tool , localTools types.ToolSet ) (types.Tool , error ) {
274
274
if existing , ok := prg .ToolSet [tool .ID ]; ok {
275
275
return existing , nil
276
276
}
@@ -319,7 +319,7 @@ func link(ctx context.Context, prg *types.Program, base *Source, tool types.Tool
319
319
subTool = strings .TrimSpace (subTool )
320
320
}
321
321
322
- resolvedTool , err := Resolve (ctx , prg , base , toolName , subTool )
322
+ resolvedTool , err := resolve (ctx , prg , base , toolName , subTool )
323
323
if err != nil {
324
324
return types.Tool {}, fmt .Errorf ("failed resolving %s at %s: %w" , targetToolName , base , err )
325
325
}
@@ -343,15 +343,15 @@ func Program(ctx context.Context, name, subToolName string) (types.Program, erro
343
343
prg := types.Program {
344
344
ToolSet : types.ToolSet {},
345
345
}
346
- tool , err := Resolve (ctx , & prg , & Source {}, name , subToolName )
346
+ tool , err := resolve (ctx , & prg , & source {}, name , subToolName )
347
347
if err != nil {
348
348
return types.Program {}, err
349
349
}
350
350
prg .EntryToolID = tool .ID
351
351
return prg , nil
352
352
}
353
353
354
- func Resolve (ctx context.Context , prg * types.Program , base * Source , name , subTool string ) (types.Tool , error ) {
354
+ func resolve (ctx context.Context , prg * types.Program , base * source , name , subTool string ) (types.Tool , error ) {
355
355
if subTool == "" {
356
356
t , ok := builtin .Builtin (name )
357
357
if ok {
@@ -360,15 +360,15 @@ func Resolve(ctx context.Context, prg *types.Program, base *Source, name, subToo
360
360
}
361
361
}
362
362
363
- s , err := Input (ctx , base , name )
363
+ s , err := input (ctx , base , name )
364
364
if err != nil {
365
365
return types.Tool {}, err
366
366
}
367
367
368
- return ReadTool (ctx , prg , s , subTool )
368
+ return readTool (ctx , prg , s , subTool )
369
369
}
370
370
371
- func Input (ctx context.Context , base * Source , name string ) (* Source , error ) {
371
+ func input (ctx context.Context , base * source , name string ) (* source , error ) {
372
372
if ! base .Remote {
373
373
s , ok , err := loadLocal (base , name )
374
374
if err != nil || ok {
0 commit comments