Skip to content

Commit 554eddc

Browse files
committed
Use Go tool system to manage "go-bindata" tool dependency
The "go-bindata" tool is used to embed the JSON schemas used by Arduino Lint's rules as Go code, allowing the tool installation to consist of a single executable file. Previously, the tool was installed via a `go install` command in the task. This approach is problematic for several reasons: - It installs the tool globally (in GOBIN), and thus pollutes the contributor's global environment - The tool must be updated manually Since go-bindata is a Go module-based project, it can be installed and managed by using the Go modules system, which has explicit support for tool dependencies as of the Go 1.24 release. This will allow keeping the dependency updated via the Dependabot service, just as is done with the Go module dependencies of the codebase, and other tool dependencies.
1 parent 67242bf commit 554eddc

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

Taskfile.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,24 @@ tasks:
334334
go:generate:
335335
desc: Generate Go code
336336
cmds:
337-
- go install "github.com/go-bindata/go-bindata/...@v3.1.1"
338-
- go-bindata -nocompress -nometadata -o "./internal/rule/schema/schemadata/bindata.go" --pkg schemadata --prefix "./etc/schemas/" "./etc/schemas/"
339-
- go-bindata -nocompress -nometadata -o "./internal/rule/schema/testdata/bindata.go" --pkg testdata --prefix "./internal/rule/schema/testdata/input/" "./internal/rule/schema/testdata/input/"
337+
- |
338+
go tool \
339+
github.com/go-bindata/go-bindata/go-bindata \
340+
-nocompress \
341+
-nometadata \
342+
-o "./internal/rule/schema/schemadata/bindata.go" \
343+
--pkg schemadata \
344+
--prefix "./etc/schemas/" \
345+
"./etc/schemas/"
346+
- |
347+
go tool \
348+
github.com/go-bindata/go-bindata/go-bindata \
349+
-nocompress \
350+
-nometadata \
351+
-o "./internal/rule/schema/testdata/bindata.go" \
352+
--pkg testdata \
353+
--prefix "./internal/rule/schema/testdata/input/" \
354+
"./internal/rule/schema/testdata/input/"
340355
- go install golang.org/x/tools/cmd/stringer@v0.25.0
341356
- go generate ./...
342357
- task: go:format

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ require (
5151
github.com/emirpasic/gods v1.18.1 // indirect
5252
github.com/fatih/color v1.18.0 // indirect
5353
github.com/fsnotify/fsnotify v1.9.0 // indirect
54+
github.com/go-bindata/go-bindata v3.1.1+incompatible // indirect
5455
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
5556
github.com/go-git/go-billy/v5 v5.6.2 // indirect
5657
github.com/go-ini/ini v1.67.0 // indirect
@@ -148,6 +149,7 @@ require (
148149
)
149150

150151
tool (
152+
github.com/go-bindata/go-bindata/go-bindata
151153
github.com/go-task/task/v3/cmd/task
152154
github.com/mikefarah/yq/v4
153155
)

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
259259
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
260260
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
261261
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
262+
github.com/go-bindata/go-bindata v3.1.1+incompatible h1:tR4f0e4VTO7LK6B2YWyAoVEzG9ByG1wrXB4TL9+jiYg=
262263
github.com/go-bindata/go-bindata v3.1.1+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
263264
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
264265
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=

0 commit comments

Comments
 (0)