Skip to content

Commit e1f61b0

Browse files
committed
Rename vars to improve clarity
1 parent 92f5e0d commit e1f61b0

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

workspace/workspace.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,25 +97,25 @@ func (ws Workspace) Exercises() ([]Exercise, error) {
9797

9898
// ExerciseDir determines the root directory of an exercise.
9999
// This is the directory that contains the exercise metadata file.
100-
func (ws Workspace) ExerciseDir(s string) (string, error) {
101-
if !strings.HasPrefix(s, ws.Dir) {
100+
func (ws Workspace) ExerciseDir(dir string) (string, error) {
101+
if !strings.HasPrefix(dir, ws.Dir) {
102102
return "", errors.New("not in workspace")
103103
}
104104

105-
path := s
105+
currentDir := dir
106106
for {
107-
if path == ws.Dir {
107+
if currentDir == ws.Dir {
108108
return "", errMissingMetadata
109109
}
110-
if _, err := os.Lstat(path); os.IsNotExist(err) {
110+
if _, err := os.Lstat(currentDir); os.IsNotExist(err) {
111111
return "", err
112112
}
113-
if _, err := os.Lstat(filepath.Join(path, metadataFilepath)); err == nil {
114-
return path, nil
113+
if _, err := os.Lstat(filepath.Join(currentDir, metadataFilepath)); err == nil {
114+
return currentDir, nil
115115
}
116-
if _, err := os.Lstat(filepath.Join(path, legacyMetadataFilename)); err == nil {
117-
return path, nil
116+
if _, err := os.Lstat(filepath.Join(currentDir, legacyMetadataFilename)); err == nil {
117+
return currentDir, nil
118118
}
119-
path = filepath.Dir(path)
119+
currentDir = filepath.Dir(currentDir)
120120
}
121121
}

0 commit comments

Comments
 (0)