Use go 1.24 new tool feature (#27765)

Release notes: https://tip.golang.org/doc/go1.24

> Go modules can now track executable dependencies using tool directives
in go.mod. This removes the need for the previous workaround of adding
tools as blank imports to a file conventionally named “tools.go”. The go
tool command can now run these tools in addition to tools shipped with
the Go distribution. For more information see [the
documentation](https://tip.golang.org/doc/modules/managing-dependencies#tools).
The new -tool flag for go get causes a tool directive to be added to the
current module for named packages in addition to adding require
directives.

I ran:
```
go get -tool github.com/fleetdm/fleet/v4/server/goose
go get -tool github.com/kevinburke/go-bindata
go get -tool github.com/quasilyte/go-ruleguard/dsl
go rm tools.go
go mod tidy
```

`make deps-go` was failing in CI because of the removal of `tools.go`
(my guess is that `go get .` was a nop because there was nothing in `.`
to download).
So, taking the chance of removing `deps-go` because `go` will download
packages during the build process. AFAICS there's no need to download
everything beforehand.
This commit is contained in:
Lucas Manuel Rodriguez
2025-04-07 11:12:05 -03:00
committed by GitHub
parent d51f2815ad
commit 8003227554
13 changed files with 10 additions and 53 deletions
@@ -53,9 +53,6 @@ jobs:
with:
go-version-file: "go.mod"
- name: Install Go Dependencies
run: make deps-go
- name: Build fleetdm/wix
run: make wix-docker
-4
View File
@@ -76,10 +76,6 @@ jobs:
if: steps.js-cache.outputs.cache-hit != 'true'
run: make deps-js
- name: Install Go Dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make deps-go
- name: Generate static files
run: |
export PATH=$PATH:~/go/bin
@@ -28,9 +28,6 @@ jobs:
with:
go-version-file: "go.mod"
- name: Install Go Dependencies
run: make deps-go
- name: Build binaries
run: make fleetd-tables-all
-3
View File
@@ -57,9 +57,6 @@ jobs:
- name: Install JS Dependencies
run: make deps-js
- name: Install Go Dependencies
run: make deps-go
- name: Install macOS signing + notarization tools
run: |
pushd /tmp
-4
View File
@@ -81,10 +81,6 @@ jobs:
sudo cp tools/smtp4dev/fleet.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates
# It seems faster not to cache Go dependencies
- name: Install Go Dependencies
run: make deps-go
- name: Generate static files
run: |
export PATH=$PATH:~/go/bin
@@ -61,9 +61,6 @@ jobs:
# let's smoke test pkg/msi generation before pushing.
#
- name: Install Go Dependencies
run: make deps-go
- name: Build fleetctl
run: make fleetctl
-4
View File
@@ -84,10 +84,6 @@ jobs:
sudo cp tools/smtp4dev/fleet.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates
# Go dependencies are cached by actions/setup-go
- name: Install Go Dependencies
run: make deps-go
# This step takes >20 seconds and should be skipped for jobs that don't need it. https://github.com/fleetdm/fleet/issues/27435
- name: Install ZSH
run: sudo apt update && sudo apt install -y zsh
@@ -67,10 +67,6 @@ jobs:
with:
go-version-file: 'go.mod'
- name: Install Go Dependencies
if: ${{ matrix.build_type == 'local' }}
run: make deps-go
- name: Build fleetdm/wix
if: ${{ matrix.build_type == 'local' }}
run: make wix-docker
@@ -57,9 +57,6 @@ jobs:
with:
go-version-file: "go.mod"
- name: Install Go Dependencies
run: make deps-go
- name: Build fleetctl
run: make fleetctl
-4
View File
@@ -94,10 +94,6 @@ jobs:
rm -f wix.zip
echo wix installed at $(pwd)/wix
# It seems faster not to cache Go dependencies
- name: Install Go Dependencies
run: make deps-go
- name: Build fleetctl
run: make fleetctl
+1 -5
View File
@@ -382,15 +382,11 @@ generate-doc: doc
.help-short--deps:
@echo "Install dependent programs and libraries"
deps: deps-js deps-go
deps: deps-js
deps-js:
yarn
# We found that 'go get .' is faster than 'go mod download' in CI (dependencies are cached by actions/setup-go)
deps-go:
GOFLAGS=-mod=readonly go get .
# check that the generated files in tools/cloner-check/generated_files match
# the current version of the cloneable structures.
check-go-cloner:
+9 -3
View File
@@ -37,6 +37,7 @@ require (
github.com/doug-martin/goqu/v9 v9.18.0
github.com/e-dard/netbug v0.0.0-20151029172837-e64d308a0b20
github.com/elazarl/go-bindata-assetfs v1.0.1
github.com/elimity-com/scim v0.0.0-20240320110924-172bf2aee9c8
github.com/facebookincubator/flog v0.0.0-20190930132826-d2511d0ce33c
github.com/fatih/color v1.16.0
github.com/getsentry/sentry-go v0.18.0
@@ -69,7 +70,6 @@ require (
github.com/igm/sockjs-go/v3 v3.0.2
github.com/jmoiron/sqlx v1.3.5
github.com/josephspurrier/goversioninfo v1.4.0
github.com/kevinburke/go-bindata v3.24.0+incompatible
github.com/klauspost/compress v1.17.11
github.com/kolide/launcher v1.0.12
github.com/lib/pq v1.10.9
@@ -100,6 +100,7 @@ require (
github.com/russellhaering/goxmldsig v1.2.0
github.com/saferwall/pe v1.5.5
github.com/sassoftware/relic/v8 v8.0.1
github.com/scim2/filter-parser/v2 v2.2.0
github.com/scjalliance/comshim v0.0.0-20230315213746-5e51f40bd3b9
github.com/sethvargo/go-password v0.3.0
github.com/shirou/gopsutil/v3 v3.24.3
@@ -189,7 +190,6 @@ require (
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/elastic/go-sysinfo v1.11.2 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
github.com/elimity-com/scim v0.0.0-20240320110924-172bf2aee9c8 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
@@ -228,6 +228,7 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/kevinburke/go-bindata v3.24.0+incompatible // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/kolide/kit v0.0.0-20221107170827-fb85e3d59eab // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
@@ -252,7 +253,6 @@ require (
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/scim2/filter-parser/v2 v2.2.0 // indirect
github.com/secDre4mer/pkcs7 v0.0.0-20240322103146-665324a4461d // indirect
github.com/secure-systems-lab/go-securesystemslib v0.5.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
@@ -292,3 +292,9 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
tool (
github.com/fleetdm/fleet/v4/server/goose
github.com/kevinburke/go-bindata
github.com/quasilyte/go-ruleguard/dsl
)
-10
View File
@@ -1,10 +0,0 @@
//go:build tools
// +build tools
package tools
import (
_ "github.com/fleetdm/fleet/v4/server/goose"
_ "github.com/kevinburke/go-bindata"
_ "github.com/quasilyte/go-ruleguard/dsl"
)