Skip to content

Commit e7e0b45

Browse files
committed
remove unused paths translation mode TranslateModeLocalAbsoluteFile
1 parent 8a8c084 commit e7e0b45

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

bundle/config/mutator/paths/translation_mode.go

-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ const (
1313
// TranslateModeDirectory translates a path to a remote directory.
1414
TranslateModeDirectory
1515

16-
// TranslateModeLocalAbsoluteFile translates a path to the local absolute file path.
17-
// It returns an error if the path does not exist or is a directory.
18-
TranslateModeLocalAbsoluteFile
19-
2016
// TranslateModeLocalAbsoluteDirectory translates a path to the local absolute directory path.
2117
// It returns an error if the path does not exist or is not a directory.
2218
TranslateModeLocalAbsoluteDirectory

bundle/config/mutator/translate_paths.go

-16
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ func (t *translateContext) rewritePath(
141141
interp, err = t.translateFilePath(ctx, input, localPath, localRelPath)
142142
case paths.TranslateModeDirectory:
143143
interp, err = t.translateDirectoryPath(ctx, input, localPath, localRelPath)
144-
case paths.TranslateModeLocalAbsoluteFile:
145-
interp, err = t.translateLocalAbsoluteFilePath(ctx, input, localPath, localRelPath)
146144
case paths.TranslateModeLocalAbsoluteDirectory:
147145
interp, err = t.translateLocalAbsoluteDirectoryPath(ctx, input, localPath, localRelPath)
148146
case paths.TranslateModeLocalRelative:
@@ -232,20 +230,6 @@ func (t *translateContext) translateDirectoryPath(ctx context.Context, literal,
232230
return path.Join(t.remoteRoot, localRelPath), nil
233231
}
234232

235-
func (t *translateContext) translateLocalAbsoluteFilePath(ctx context.Context, literal, localFullPath, localRelPath string) (string, error) {
236-
info, err := t.b.SyncRoot.Stat(localRelPath)
237-
if errors.Is(err, fs.ErrNotExist) {
238-
return "", fmt.Errorf("file %s not found", literal)
239-
}
240-
if err != nil {
241-
return "", fmt.Errorf("unable to determine if %s is a file: %w", filepath.FromSlash(localFullPath), err)
242-
}
243-
if info.IsDir() {
244-
return "", fmt.Errorf("expected %s to be a file but found a directory", literal)
245-
}
246-
return localFullPath, nil
247-
}
248-
249233
func (t *translateContext) translateLocalAbsoluteDirectoryPath(ctx context.Context, literal, localFullPath, _ string) (string, error) {
250234
info, err := os.Stat(filepath.FromSlash(localFullPath))
251235
if errors.Is(err, fs.ErrNotExist) {

0 commit comments

Comments
 (0)