Skip to content

Commit dffe754

Browse files
Make some APIs private
1 parent dd81b27 commit dffe754

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pkg/loader/loader.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ const (
3030
githubRawURL = "https://raw.githubusercontent.com/"
3131
)
3232

33-
type Source struct {
33+
type source struct {
3434
Content io.ReadCloser
3535
Remote bool
3636
Path string
3737
Name string
3838
File string
3939
}
4040

41-
func (s *Source) String() string {
41+
func (s *source) String() string {
4242
if s.Path == "" && s.Name == "" {
4343
return ""
4444
}
@@ -55,7 +55,7 @@ func openFile(path string) (io.ReadCloser, bool, error) {
5555
return f, true, nil
5656
}
5757

58-
func loadLocal(base *Source, name string) (*Source, bool, error) {
58+
func loadLocal(base *source, name string) (*source, bool, error) {
5959
path := filepath.Join(base.Path, name)
6060

6161
content, ok, err := openFile(path)
@@ -66,7 +66,7 @@ func loadLocal(base *Source, name string) (*Source, bool, error) {
6666
}
6767
log.Debugf("opened %s", path)
6868

69-
return &Source{
69+
return &source{
7070
Content: content,
7171
Remote: false,
7272
Path: filepath.Dir(path),
@@ -95,7 +95,7 @@ func githubURL(urlName string) (string, bool) {
9595
return url, true
9696
}
9797

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) {
9999
url := name
100100
if base.Path != "" {
101101
url = base.Path + "/" + name
@@ -129,7 +129,7 @@ func loadURL(ctx context.Context, base *Source, name string) (*Source, bool, err
129129
pathURL := *parsed
130130
pathURL.Path = filepath.Dir(parsed.Path)
131131

132-
return &Source{
132+
return &source{
133133
Content: resp.Body,
134134
Remote: true,
135135
Path: pathURL.String(),
@@ -174,7 +174,7 @@ func loadProgram(data []byte, into *types.Program, targetToolName string) (types
174174
return tool, nil
175175
}
176176

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) {
178178
data, err := io.ReadAll(base.Content)
179179
if err != nil {
180180
return types.Tool{}, err
@@ -270,7 +270,7 @@ func pickToolName(toolName string, existing map[string]struct{}) string {
270270
}
271271
}
272272

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) {
274274
if existing, ok := prg.ToolSet[tool.ID]; ok {
275275
return existing, nil
276276
}
@@ -319,7 +319,7 @@ func link(ctx context.Context, prg *types.Program, base *Source, tool types.Tool
319319
subTool = strings.TrimSpace(subTool)
320320
}
321321

322-
resolvedTool, err := Resolve(ctx, prg, base, toolName, subTool)
322+
resolvedTool, err := resolve(ctx, prg, base, toolName, subTool)
323323
if err != nil {
324324
return types.Tool{}, fmt.Errorf("failed resolving %s at %s: %w", targetToolName, base, err)
325325
}
@@ -343,15 +343,15 @@ func Program(ctx context.Context, name, subToolName string) (types.Program, erro
343343
prg := types.Program{
344344
ToolSet: types.ToolSet{},
345345
}
346-
tool, err := Resolve(ctx, &prg, &Source{}, name, subToolName)
346+
tool, err := resolve(ctx, &prg, &source{}, name, subToolName)
347347
if err != nil {
348348
return types.Program{}, err
349349
}
350350
prg.EntryToolID = tool.ID
351351
return prg, nil
352352
}
353353

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) {
355355
if subTool == "" {
356356
t, ok := builtin.Builtin(name)
357357
if ok {
@@ -360,15 +360,15 @@ func Resolve(ctx context.Context, prg *types.Program, base *Source, name, subToo
360360
}
361361
}
362362

363-
s, err := Input(ctx, base, name)
363+
s, err := input(ctx, base, name)
364364
if err != nil {
365365
return types.Tool{}, err
366366
}
367367

368-
return ReadTool(ctx, prg, s, subTool)
368+
return readTool(ctx, prg, s, subTool)
369369
}
370370

371-
func Input(ctx context.Context, base *Source, name string) (*Source, error) {
371+
func input(ctx context.Context, base *source, name string) (*source, error) {
372372
if !base.Remote {
373373
s, ok, err := loadLocal(base, name)
374374
if err != nil || ok {

0 commit comments

Comments
 (0)