Skip to content

Commit e953c6b

Browse files
committed
Remove trailing slash from path variable values
Paths in some workflows and tasks are configured via variables. Previously, when a value specified a folder path, a trailing slash was added. The intent behind this was to make it slightly more clear that the value was referring to a folder (e.g., `./` vs. `.`). However, this practice can be harmful in the case where the value is used as a base component in a path, as then it is most appropriate to omit the path separator in the concatenation code, which is at all clear (e.g., `FOO_PATH: foo/`, `{{.FOO_PATH}}bar` -> `foo/bar`). And if the separator is used in the concatenation code, it results in a confusing double separator in the resulting path (e.g., `FOO_PATH: foo/`, `{{.FOO_PATH}}/bar` -> `foo//bar`). The benefit of the trailing slash on the variable definition is miniscule at most, since the variable name, documentation, and other context should make it obvious that the value is a folder path. So the harm of this approach outweighs the benefit. For this reason, it is better to omit the trailing slash in the variable definition (e.g., `FOO_PATH: foo`, `{{.FOO_PATH}}/bar` -> `foo/bar`). Even though this approach is not relevant in cases where the path is not used as a base component, it is best to be consistent in this practice.
1 parent 7223866 commit e953c6b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

.github/workflows/check-go-task.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797

9898
matrix:
9999
module:
100-
- path: ./
100+
- path: .
101101

102102
steps:
103103
- name: Checkout repository
@@ -138,7 +138,7 @@ jobs:
138138

139139
matrix:
140140
module:
141-
- path: ./
141+
- path: .
142142

143143
steps:
144144
- name: Checkout repository
@@ -179,7 +179,7 @@ jobs:
179179

180180
matrix:
181181
module:
182-
- path: ./
182+
- path: .
183183

184184
steps:
185185
- name: Checkout repository

.github/workflows/check-license.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565

6666
matrix:
6767
check-license:
68-
- path: ./
68+
- path: .
6969
expected-filename: LICENSE.txt
7070
# SPDX identifier: https://spdx.org/licenses/
7171
expected-type: GPL-3.0

Taskfile.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ includes:
77
vars:
88
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go-task/Taskfile.yml
99
# Path of the project's primary Go module:
10-
DEFAULT_GO_MODULE_PATH: ./
10+
DEFAULT_GO_MODULE_PATH: .
1111
DEFAULT_GO_PACKAGES:
1212
sh: |
1313
echo $(
@@ -16,7 +16,7 @@ vars:
1616
echo '"ERROR: Unable to discover Go packages"'
1717
)
1818
# Path of the primary npm-managed project:
19-
DEFAULT_NPM_PROJECT_PATH: ./
19+
DEFAULT_NPM_PROJECT_PATH: .
2020
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/Taskfile.yml
2121
PROJECT_NAME: "arduinoOTA"
2222
DIST_DIR: "dist"

0 commit comments

Comments
 (0)