Skip to content

Commit 7b4c2f9

Browse files
committed
lint: bubble up error in wrapped call
1 parent 98234d4 commit 7b4c2f9

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

bin/golangci-lint

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# Code generated by go.husin.dev/toolstub@(devel). DO NOT EDIT.
3+
# Code generated by go.husin.dev/toolstub@v0.2.0-98234d400a07687995163c014781efb26cb150f7. DO NOT EDIT.
44

55
set -euo pipefail
66

@@ -34,12 +34,13 @@ function install_tool() {
3434

3535
# 3. Run!
3636
function run() {
37-
go tool -modfile="${modfile}" "${TOOLIMPORT}"
37+
# shellcheck disable=SC2068 # Intentionally splat args from user / console.
38+
go tool -modfile="${modfile}" "${TOOLIMPORT}" $@
3839
}
3940

4041
function main() {
4142
DEBUG_TOOLSTUB=${DEBUG_TOOLSTUB:-""}
42-
if [[ ! -z "${DEBUG_TOOLSTUB}" ]]; then
43+
if [[ -n "${DEBUG_TOOLSTUB}" ]]; then
4344
yellow=$(tput setaf 3)
4445
magenta=$(tput setaf 5)
4546
cyan=$(tput setaf 6)
@@ -51,7 +52,9 @@ function main() {
5152

5253
gomod
5354
install_tool
55+
# shellcheck disable=SC2068 # Intentionally splat args from user / console.
5456
run $@
5557
}
5658

59+
# shellcheck disable=SC2068 # Intentionally splat args from user / console.
5760
main $@

bin/goreleaser

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# Code generated by go.husin.dev/toolstub@v0.1.0+dirty-6c31d38a170f09d33c0962237fc2af4a2d172075. DO NOT EDIT.
3+
# Code generated by go.husin.dev/toolstub@v0.2.0-98234d400a07687995163c014781efb26cb150f7. DO NOT EDIT.
44

55
set -euo pipefail
66

@@ -34,12 +34,13 @@ function install_tool() {
3434

3535
# 3. Run!
3636
function run() {
37+
# shellcheck disable=SC2068 # Intentionally splat args from user / console.
3738
go tool -modfile="${modfile}" "${TOOLIMPORT}" $@
3839
}
3940

4041
function main() {
4142
DEBUG_TOOLSTUB=${DEBUG_TOOLSTUB:-""}
42-
if [[ ! -z "${DEBUG_TOOLSTUB}" ]]; then
43+
if [[ -n "${DEBUG_TOOLSTUB}" ]]; then
4344
yellow=$(tput setaf 3)
4445
magenta=$(tput setaf 5)
4546
cyan=$(tput setaf 6)
@@ -51,7 +52,9 @@ function main() {
5152

5253
gomod
5354
install_tool
55+
# shellcheck disable=SC2068 # Intentionally splat args from user / console.
5456
run $@
5557
}
5658

59+
# shellcheck disable=SC2068 # Intentionally splat args from user / console.
5760
main $@

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func run() error {
6363

6464
f, err := os.OpenFile(fp, os.O_RDWR|os.O_CREATE, 0755)
6565
if err != nil {
66-
return fmt.Errorf("opening file %q to write: %w", fp)
66+
return fmt.Errorf("opening file %q to write: %w", fp, err)
6767
}
6868
defer f.Close()
6969

0 commit comments

Comments
 (0)