Explorar o código

build: use Go 1.24 tools pattern (#10281)

Jakob Borg hai 1 mes
pai
achega
01257e838b

+ 8 - 2
go.mod

@@ -24,7 +24,6 @@ require (
 	github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
 	github.com/maruel/panicparse/v2 v2.5.0
 	github.com/mattn/go-sqlite3 v1.14.31
-	github.com/maxbrunsfeld/counterfeiter/v6 v6.11.3
 	github.com/maxmind/geoipupdate/v6 v6.1.0
 	github.com/miscreant/miscreant.go v0.0.0-20200214223636-26d376326b75
 	github.com/oschwald/geoip2-golang v1.13.0
@@ -49,7 +48,6 @@ require (
 	golang.org/x/sys v0.35.0
 	golang.org/x/text v0.28.0
 	golang.org/x/time v0.12.0
-	golang.org/x/tools v0.36.0
 	google.golang.org/protobuf v1.36.7
 	modernc.org/sqlite v1.38.2
 	sigs.k8s.io/yaml v1.6.0
@@ -79,6 +77,7 @@ require (
 	github.com/jmespath/go-jmespath v0.4.0 // indirect
 	github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
 	github.com/mattn/go-isatty v0.0.20 // indirect
+	github.com/maxbrunsfeld/counterfeiter/v6 v6.11.3 // indirect
 	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
 	github.com/ncruces/go-strftime v0.1.9 // indirect
 	github.com/nxadm/tail v1.4.11 // indirect
@@ -103,6 +102,7 @@ require (
 	go.yaml.in/yaml/v2 v2.4.2 // indirect
 	golang.org/x/mod v0.27.0 // indirect
 	golang.org/x/sync v0.16.0 // indirect
+	golang.org/x/tools v0.36.0 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
 	modernc.org/libc v1.66.3 // indirect
 	modernc.org/mathutil v1.7.1 // indirect
@@ -114,3 +114,9 @@ replace github.com/gobwas/glob v0.2.3 => github.com/calmh/glob v0.0.0-2022061508
 
 // https://github.com/mattn/go-sqlite3/pull/1338
 replace github.com/mattn/go-sqlite3 v1.14.31 => github.com/calmh/go-sqlite3 v1.14.32-0.20250812195006-80712c77b76a
+
+tool (
+	github.com/calmh/xdr/cmd/genxdr
+	github.com/maxbrunsfeld/counterfeiter/v6
+	golang.org/x/tools/cmd/goimports
+)

+ 0 - 54
lib/config/mocks/mocked_wrapper.go

@@ -1809,60 +1809,6 @@ func (fake *Wrapper) UnsubscribeArgsForCall(i int) config.Committer {
 func (fake *Wrapper) Invocations() map[string][][]interface{} {
 	fake.invocationsMutex.RLock()
 	defer fake.invocationsMutex.RUnlock()
-	fake.configPathMutex.RLock()
-	defer fake.configPathMutex.RUnlock()
-	fake.defaultDeviceMutex.RLock()
-	defer fake.defaultDeviceMutex.RUnlock()
-	fake.defaultFolderMutex.RLock()
-	defer fake.defaultFolderMutex.RUnlock()
-	fake.defaultIgnoresMutex.RLock()
-	defer fake.defaultIgnoresMutex.RUnlock()
-	fake.deviceMutex.RLock()
-	defer fake.deviceMutex.RUnlock()
-	fake.deviceListMutex.RLock()
-	defer fake.deviceListMutex.RUnlock()
-	fake.devicesMutex.RLock()
-	defer fake.devicesMutex.RUnlock()
-	fake.folderMutex.RLock()
-	defer fake.folderMutex.RUnlock()
-	fake.folderListMutex.RLock()
-	defer fake.folderListMutex.RUnlock()
-	fake.folderPasswordsMutex.RLock()
-	defer fake.folderPasswordsMutex.RUnlock()
-	fake.foldersMutex.RLock()
-	defer fake.foldersMutex.RUnlock()
-	fake.gUIMutex.RLock()
-	defer fake.gUIMutex.RUnlock()
-	fake.ignoredDeviceMutex.RLock()
-	defer fake.ignoredDeviceMutex.RUnlock()
-	fake.ignoredDevicesMutex.RLock()
-	defer fake.ignoredDevicesMutex.RUnlock()
-	fake.ignoredFolderMutex.RLock()
-	defer fake.ignoredFolderMutex.RUnlock()
-	fake.lDAPMutex.RLock()
-	defer fake.lDAPMutex.RUnlock()
-	fake.modifyMutex.RLock()
-	defer fake.modifyMutex.RUnlock()
-	fake.myIDMutex.RLock()
-	defer fake.myIDMutex.RUnlock()
-	fake.optionsMutex.RLock()
-	defer fake.optionsMutex.RUnlock()
-	fake.rawCopyMutex.RLock()
-	defer fake.rawCopyMutex.RUnlock()
-	fake.removeDeviceMutex.RLock()
-	defer fake.removeDeviceMutex.RUnlock()
-	fake.removeFolderMutex.RLock()
-	defer fake.removeFolderMutex.RUnlock()
-	fake.requiresRestartMutex.RLock()
-	defer fake.requiresRestartMutex.RUnlock()
-	fake.saveMutex.RLock()
-	defer fake.saveMutex.RUnlock()
-	fake.serveMutex.RLock()
-	defer fake.serveMutex.RUnlock()
-	fake.subscribeMutex.RLock()
-	defer fake.subscribeMutex.RUnlock()
-	fake.unsubscribeMutex.RLock()
-	defer fake.unsubscribeMutex.RUnlock()
 	copiedInvocations := map[string][][]interface{}{}
 	for key, value := range fake.invocations {
 		copiedInvocations[key] = value

+ 1 - 2
lib/config/wrapper.go

@@ -4,8 +4,7 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this file,
 // You can obtain one at https://mozilla.org/MPL/2.0/.
 
-//go:generate -command counterfeiter go run github.com/maxbrunsfeld/counterfeiter/v6
-//go:generate counterfeiter -o mocks/mocked_wrapper.go --fake-name Wrapper . Wrapper
+//go:generate go tool counterfeiter -o mocks/mocked_wrapper.go --fake-name Wrapper . Wrapper
 
 package config
 

+ 0 - 12
lib/connections/mocks/service.go

@@ -403,18 +403,6 @@ func (fake *Service) ServeReturnsOnCall(i int, result1 error) {
 func (fake *Service) Invocations() map[string][][]interface{} {
 	fake.invocationsMutex.RLock()
 	defer fake.invocationsMutex.RUnlock()
-	fake.allAddressesMutex.RLock()
-	defer fake.allAddressesMutex.RUnlock()
-	fake.connectionStatusMutex.RLock()
-	defer fake.connectionStatusMutex.RUnlock()
-	fake.externalAddressesMutex.RLock()
-	defer fake.externalAddressesMutex.RUnlock()
-	fake.listenerStatusMutex.RLock()
-	defer fake.listenerStatusMutex.RUnlock()
-	fake.nATTypeMutex.RLock()
-	defer fake.nATTypeMutex.RUnlock()
-	fake.serveMutex.RLock()
-	defer fake.serveMutex.RUnlock()
 	copiedInvocations := map[string][][]interface{}{}
 	for key, value := range fake.invocations {
 		copiedInvocations[key] = value

+ 1 - 2
lib/connections/service.go

@@ -4,8 +4,7 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this file,
 // You can obtain one at https://mozilla.org/MPL/2.0/.
 
-//go:generate -command counterfeiter go run github.com/maxbrunsfeld/counterfeiter/v6
-//go:generate counterfeiter -o mocks/service.go --fake-name Service . Service
+//go:generate go tool counterfeiter -o mocks/service.go --fake-name Service . Service
 
 package connections
 

+ 1 - 2
lib/discover/manager.go

@@ -4,8 +4,7 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this file,
 // You can obtain one at https://mozilla.org/MPL/2.0/.
 
-//go:generate -command counterfeiter go run github.com/maxbrunsfeld/counterfeiter/v6
-//go:generate counterfeiter -o mocks/manager.go --fake-name Manager . Manager
+//go:generate go tool counterfeiter -o mocks/manager.go --fake-name Manager . Manager
 
 package discover
 

+ 0 - 12
lib/discover/mocks/manager.go

@@ -420,18 +420,6 @@ func (fake *Manager) StringReturnsOnCall(i int, result1 string) {
 func (fake *Manager) Invocations() map[string][][]interface{} {
 	fake.invocationsMutex.RLock()
 	defer fake.invocationsMutex.RUnlock()
-	fake.cacheMutex.RLock()
-	defer fake.cacheMutex.RUnlock()
-	fake.childErrorsMutex.RLock()
-	defer fake.childErrorsMutex.RUnlock()
-	fake.errorMutex.RLock()
-	defer fake.errorMutex.RUnlock()
-	fake.lookupMutex.RLock()
-	defer fake.lookupMutex.RUnlock()
-	fake.serveMutex.RLock()
-	defer fake.serveMutex.RUnlock()
-	fake.stringMutex.RLock()
-	defer fake.stringMutex.RUnlock()
 	copiedInvocations := map[string][][]interface{}{}
 	for key, value := range fake.invocations {
 		copiedInvocations[key] = value

+ 1 - 2
lib/events/events.go

@@ -4,8 +4,7 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this file,
 // You can obtain one at https://mozilla.org/MPL/2.0/.
 
-//go:generate -command counterfeiter go run github.com/maxbrunsfeld/counterfeiter/v6
-//go:generate counterfeiter -o mocks/buffered_subscription.go --fake-name BufferedSubscription . BufferedSubscription
+//go:generate go tool counterfeiter -o mocks/buffered_subscription.go --fake-name BufferedSubscription . BufferedSubscription
 
 // Package events provides event subscription and polling functionality.
 package events

+ 0 - 4
lib/events/mocks/buffered_subscription.go

@@ -160,10 +160,6 @@ func (fake *BufferedSubscription) SinceReturnsOnCall(i int, result1 []events.Eve
 func (fake *BufferedSubscription) Invocations() map[string][][]interface{} {
 	fake.invocationsMutex.RLock()
 	defer fake.invocationsMutex.RUnlock()
-	fake.maskMutex.RLock()
-	defer fake.maskMutex.RUnlock()
-	fake.sinceMutex.RLock()
-	defer fake.sinceMutex.RUnlock()
 	copiedInvocations := map[string][][]interface{}{}
 	for key, value := range fake.invocations {
 		copiedInvocations[key] = value

+ 1 - 2
lib/model/folder_summary.go

@@ -4,8 +4,7 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this file,
 // You can obtain one at https://mozilla.org/MPL/2.0/.
 
-//go:generate -command counterfeiter go run github.com/maxbrunsfeld/counterfeiter/v6
-//go:generate counterfeiter -o mocks/folderSummaryService.go --fake-name FolderSummaryService . FolderSummaryService
+//go:generate go tool counterfeiter -o mocks/folderSummaryService.go --fake-name FolderSummaryService . FolderSummaryService
 
 package model
 

+ 0 - 4
lib/model/mocks/folderSummaryService.go

@@ -165,10 +165,6 @@ func (fake *FolderSummaryService) SummaryReturnsOnCall(i int, result1 *model.Fol
 func (fake *FolderSummaryService) Invocations() map[string][][]interface{} {
 	fake.invocationsMutex.RLock()
 	defer fake.invocationsMutex.RUnlock()
-	fake.serveMutex.RLock()
-	defer fake.serveMutex.RUnlock()
-	fake.summaryMutex.RLock()
-	defer fake.summaryMutex.RUnlock()
 	copiedInvocations := map[string][][]interface{}{}
 	for key, value := range fake.invocations {
 		copiedInvocations[key] = value

+ 0 - 106
lib/model/mocks/model.go

@@ -3837,112 +3837,6 @@ func (fake *Model) WatchErrorReturnsOnCall(i int, result1 error) {
 func (fake *Model) Invocations() map[string][][]interface{} {
 	fake.invocationsMutex.RLock()
 	defer fake.invocationsMutex.RUnlock()
-	fake.addConnectionMutex.RLock()
-	defer fake.addConnectionMutex.RUnlock()
-	fake.allGlobalFilesMutex.RLock()
-	defer fake.allGlobalFilesMutex.RUnlock()
-	fake.availabilityMutex.RLock()
-	defer fake.availabilityMutex.RUnlock()
-	fake.bringToFrontMutex.RLock()
-	defer fake.bringToFrontMutex.RUnlock()
-	fake.closedMutex.RLock()
-	defer fake.closedMutex.RUnlock()
-	fake.clusterConfigMutex.RLock()
-	defer fake.clusterConfigMutex.RUnlock()
-	fake.completionMutex.RLock()
-	defer fake.completionMutex.RUnlock()
-	fake.connectedToMutex.RLock()
-	defer fake.connectedToMutex.RUnlock()
-	fake.connectionStatsMutex.RLock()
-	defer fake.connectionStatsMutex.RUnlock()
-	fake.currentFolderFileMutex.RLock()
-	defer fake.currentFolderFileMutex.RUnlock()
-	fake.currentGlobalFileMutex.RLock()
-	defer fake.currentGlobalFileMutex.RUnlock()
-	fake.currentIgnoresMutex.RLock()
-	defer fake.currentIgnoresMutex.RUnlock()
-	fake.delayScanMutex.RLock()
-	defer fake.delayScanMutex.RUnlock()
-	fake.deviceStatisticsMutex.RLock()
-	defer fake.deviceStatisticsMutex.RUnlock()
-	fake.dismissPendingDeviceMutex.RLock()
-	defer fake.dismissPendingDeviceMutex.RUnlock()
-	fake.dismissPendingFolderMutex.RLock()
-	defer fake.dismissPendingFolderMutex.RUnlock()
-	fake.downloadProgressMutex.RLock()
-	defer fake.downloadProgressMutex.RUnlock()
-	fake.folderErrorsMutex.RLock()
-	defer fake.folderErrorsMutex.RUnlock()
-	fake.folderProgressBytesCompletedMutex.RLock()
-	defer fake.folderProgressBytesCompletedMutex.RUnlock()
-	fake.folderStatisticsMutex.RLock()
-	defer fake.folderStatisticsMutex.RUnlock()
-	fake.getFolderVersionsMutex.RLock()
-	defer fake.getFolderVersionsMutex.RUnlock()
-	fake.globalDirectoryTreeMutex.RLock()
-	defer fake.globalDirectoryTreeMutex.RUnlock()
-	fake.globalSizeMutex.RLock()
-	defer fake.globalSizeMutex.RUnlock()
-	fake.indexMutex.RLock()
-	defer fake.indexMutex.RUnlock()
-	fake.indexUpdateMutex.RLock()
-	defer fake.indexUpdateMutex.RUnlock()
-	fake.loadIgnoresMutex.RLock()
-	defer fake.loadIgnoresMutex.RUnlock()
-	fake.localChangedFolderFilesMutex.RLock()
-	defer fake.localChangedFolderFilesMutex.RUnlock()
-	fake.localFilesMutex.RLock()
-	defer fake.localFilesMutex.RUnlock()
-	fake.localFilesSequencedMutex.RLock()
-	defer fake.localFilesSequencedMutex.RUnlock()
-	fake.localSizeMutex.RLock()
-	defer fake.localSizeMutex.RUnlock()
-	fake.needFolderFilesMutex.RLock()
-	defer fake.needFolderFilesMutex.RUnlock()
-	fake.needSizeMutex.RLock()
-	defer fake.needSizeMutex.RUnlock()
-	fake.onHelloMutex.RLock()
-	defer fake.onHelloMutex.RUnlock()
-	fake.overrideMutex.RLock()
-	defer fake.overrideMutex.RUnlock()
-	fake.pendingDevicesMutex.RLock()
-	defer fake.pendingDevicesMutex.RUnlock()
-	fake.pendingFoldersMutex.RLock()
-	defer fake.pendingFoldersMutex.RUnlock()
-	fake.receiveOnlySizeMutex.RLock()
-	defer fake.receiveOnlySizeMutex.RUnlock()
-	fake.remoteNeedFolderFilesMutex.RLock()
-	defer fake.remoteNeedFolderFilesMutex.RUnlock()
-	fake.remoteSequencesMutex.RLock()
-	defer fake.remoteSequencesMutex.RUnlock()
-	fake.requestMutex.RLock()
-	defer fake.requestMutex.RUnlock()
-	fake.requestGlobalMutex.RLock()
-	defer fake.requestGlobalMutex.RUnlock()
-	fake.resetFolderMutex.RLock()
-	defer fake.resetFolderMutex.RUnlock()
-	fake.restoreFolderVersionsMutex.RLock()
-	defer fake.restoreFolderVersionsMutex.RUnlock()
-	fake.revertMutex.RLock()
-	defer fake.revertMutex.RUnlock()
-	fake.scanFolderMutex.RLock()
-	defer fake.scanFolderMutex.RUnlock()
-	fake.scanFolderSubdirsMutex.RLock()
-	defer fake.scanFolderSubdirsMutex.RUnlock()
-	fake.scanFoldersMutex.RLock()
-	defer fake.scanFoldersMutex.RUnlock()
-	fake.sequenceMutex.RLock()
-	defer fake.sequenceMutex.RUnlock()
-	fake.serveMutex.RLock()
-	defer fake.serveMutex.RUnlock()
-	fake.setIgnoresMutex.RLock()
-	defer fake.setIgnoresMutex.RUnlock()
-	fake.stateMutex.RLock()
-	defer fake.stateMutex.RUnlock()
-	fake.usageReportingStatsMutex.RLock()
-	defer fake.usageReportingStatsMutex.RUnlock()
-	fake.watchErrorMutex.RLock()
-	defer fake.watchErrorMutex.RUnlock()
 	copiedInvocations := map[string][][]interface{}{}
 	for key, value := range fake.invocations {
 		copiedInvocations[key] = value

+ 1 - 2
lib/model/model.go

@@ -4,8 +4,7 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this file,
 // You can obtain one at https://mozilla.org/MPL/2.0/.
 
-//go:generate -command counterfeiter go run github.com/maxbrunsfeld/counterfeiter/v6
-//go:generate counterfeiter -o mocks/model.go --fake-name Model . Model
+//go:generate go tool counterfeiter -o mocks/model.go --fake-name Model . Model
 
 package model
 

+ 0 - 18
lib/protocol/mocked_connection_info_test.go

@@ -582,24 +582,6 @@ func (fake *mockedConnectionInfo) TypeReturnsOnCall(i int, result1 string) {
 func (fake *mockedConnectionInfo) Invocations() map[string][][]interface{} {
 	fake.invocationsMutex.RLock()
 	defer fake.invocationsMutex.RUnlock()
-	fake.connectionIDMutex.RLock()
-	defer fake.connectionIDMutex.RUnlock()
-	fake.cryptoMutex.RLock()
-	defer fake.cryptoMutex.RUnlock()
-	fake.establishedAtMutex.RLock()
-	defer fake.establishedAtMutex.RUnlock()
-	fake.isLocalMutex.RLock()
-	defer fake.isLocalMutex.RUnlock()
-	fake.priorityMutex.RLock()
-	defer fake.priorityMutex.RUnlock()
-	fake.remoteAddrMutex.RLock()
-	defer fake.remoteAddrMutex.RUnlock()
-	fake.stringMutex.RLock()
-	defer fake.stringMutex.RUnlock()
-	fake.transportMutex.RLock()
-	defer fake.transportMutex.RUnlock()
-	fake.typeMutex.RLock()
-	defer fake.typeMutex.RUnlock()
 	copiedInvocations := map[string][][]interface{}{}
 	for key, value := range fake.invocations {
 		copiedInvocations[key] = value

+ 0 - 38
lib/protocol/mocks/connection.go

@@ -1144,44 +1144,6 @@ func (fake *Connection) TypeReturnsOnCall(i int, result1 string) {
 func (fake *Connection) Invocations() map[string][][]interface{} {
 	fake.invocationsMutex.RLock()
 	defer fake.invocationsMutex.RUnlock()
-	fake.closeMutex.RLock()
-	defer fake.closeMutex.RUnlock()
-	fake.closedMutex.RLock()
-	defer fake.closedMutex.RUnlock()
-	fake.clusterConfigMutex.RLock()
-	defer fake.clusterConfigMutex.RUnlock()
-	fake.connectionIDMutex.RLock()
-	defer fake.connectionIDMutex.RUnlock()
-	fake.cryptoMutex.RLock()
-	defer fake.cryptoMutex.RUnlock()
-	fake.deviceIDMutex.RLock()
-	defer fake.deviceIDMutex.RUnlock()
-	fake.downloadProgressMutex.RLock()
-	defer fake.downloadProgressMutex.RUnlock()
-	fake.establishedAtMutex.RLock()
-	defer fake.establishedAtMutex.RUnlock()
-	fake.indexMutex.RLock()
-	defer fake.indexMutex.RUnlock()
-	fake.indexUpdateMutex.RLock()
-	defer fake.indexUpdateMutex.RUnlock()
-	fake.isLocalMutex.RLock()
-	defer fake.isLocalMutex.RUnlock()
-	fake.priorityMutex.RLock()
-	defer fake.priorityMutex.RUnlock()
-	fake.remoteAddrMutex.RLock()
-	defer fake.remoteAddrMutex.RUnlock()
-	fake.requestMutex.RLock()
-	defer fake.requestMutex.RUnlock()
-	fake.startMutex.RLock()
-	defer fake.startMutex.RUnlock()
-	fake.statisticsMutex.RLock()
-	defer fake.statisticsMutex.RUnlock()
-	fake.stringMutex.RLock()
-	defer fake.stringMutex.RUnlock()
-	fake.transportMutex.RLock()
-	defer fake.transportMutex.RUnlock()
-	fake.typeMutex.RLock()
-	defer fake.typeMutex.RUnlock()
 	copiedInvocations := map[string][][]interface{}{}
 	for key, value := range fake.invocations {
 		copiedInvocations[key] = value

+ 0 - 18
lib/protocol/mocks/connection_info.go

@@ -584,24 +584,6 @@ func (fake *ConnectionInfo) TypeReturnsOnCall(i int, result1 string) {
 func (fake *ConnectionInfo) Invocations() map[string][][]interface{} {
 	fake.invocationsMutex.RLock()
 	defer fake.invocationsMutex.RUnlock()
-	fake.connectionIDMutex.RLock()
-	defer fake.connectionIDMutex.RUnlock()
-	fake.cryptoMutex.RLock()
-	defer fake.cryptoMutex.RUnlock()
-	fake.establishedAtMutex.RLock()
-	defer fake.establishedAtMutex.RUnlock()
-	fake.isLocalMutex.RLock()
-	defer fake.isLocalMutex.RUnlock()
-	fake.priorityMutex.RLock()
-	defer fake.priorityMutex.RUnlock()
-	fake.remoteAddrMutex.RLock()
-	defer fake.remoteAddrMutex.RUnlock()
-	fake.stringMutex.RLock()
-	defer fake.stringMutex.RUnlock()
-	fake.transportMutex.RLock()
-	defer fake.transportMutex.RUnlock()
-	fake.typeMutex.RLock()
-	defer fake.typeMutex.RUnlock()
 	copiedInvocations := map[string][][]interface{}{}
 	for key, value := range fake.invocations {
 		copiedInvocations[key] = value

+ 3 - 5
lib/protocol/protocol.go

@@ -4,14 +4,12 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this file,
 // You can obtain one at https://mozilla.org/MPL/2.0/.
 
-//go:generate -command counterfeiter go run github.com/maxbrunsfeld/counterfeiter/v6
-
 // Prevents import loop, for internal testing
-//go:generate counterfeiter -o mocked_connection_info_test.go --fake-name mockedConnectionInfo . ConnectionInfo
+//go:generate go tool counterfeiter -o mocked_connection_info_test.go --fake-name mockedConnectionInfo . ConnectionInfo
 //go:generate go run ../../script/prune_mocks.go -t mocked_connection_info_test.go
 
-//go:generate counterfeiter -o mocks/connection_info.go --fake-name ConnectionInfo . ConnectionInfo
-//go:generate counterfeiter -o mocks/connection.go --fake-name Connection . Connection
+//go:generate go tool counterfeiter -o mocks/connection_info.go --fake-name ConnectionInfo . ConnectionInfo
+//go:generate go tool counterfeiter -o mocks/connection.go --fake-name Connection . Connection
 
 package protocol
 

+ 1 - 2
lib/relay/protocol/packets.go

@@ -1,7 +1,6 @@
 // Copyright (C) 2015 Audrius Butkevicius and Contributors (see the CONTRIBUTORS file).
 
-//go:generate -command genxdr go run github.com/calmh/xdr/cmd/genxdr
-//go:generate genxdr -o packets_xdr.go packets.go
+//go:generate go tool genxdr -o packets_xdr.go packets.go
 
 package protocol
 

+ 2 - 2
script/next-version.go

@@ -4,8 +4,8 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this file,
 // You can obtain one at https://mozilla.org/MPL/2.0/.
 
-//go:build ignore
-// +build ignore
+//go:build tools
+// +build tools
 
 package main
 

+ 1 - 1
script/prune_mocks.go

@@ -35,7 +35,7 @@ func main() {
 		if err != nil {
 			log.Fatal(err)
 		}
-		err = exec.Command("go", "run", "golang.org/x/tools/cmd/goimports", "-w", path).Run()
+		err = exec.Command("go", "tool", "goimports", "-w", path).Run()
 		if err != nil {
 			log.Fatal(err)
 		}

+ 0 - 15
tools.go

@@ -1,15 +0,0 @@
-// This file is never built. It serves to establish dependencies on tools
-// used by go generate and build.go. See
-// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
-
-//go:build tools
-// +build tools
-
-package tools
-
-import (
-	_ "github.com/calmh/xdr"
-	_ "github.com/coreos/go-semver/semver"
-	_ "github.com/maxbrunsfeld/counterfeiter/v6"
-	_ "golang.org/x/tools/cmd/goimports"
-)