This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-go.git


The following commit(s) were added to refs/heads/main by this push:
     new deed26ca chore: remove tools.go files in favor of go.mod "tool" 
directive (#759)
deed26ca is described below

commit deed26cafb9323c32e3245f683087d25c55aae06
Author: Sebastiaan van Stijn <[email protected]>
AuthorDate: Mon Apr 13 18:57:53 2026 +0200

    chore: remove tools.go files in favor of go.mod "tool" directive (#759)
    
    This prevents dependencies used for `//go:generate` from being included
    as a direct dependency, while preserving the ability to specify the
    version to use through go.mod (as `//indirect` dependency if not used
    elsehwere).
    
    Tools specified in go.mod can be downloaded with `go get -tool`, e.g.;
    
        go get -tool github.com/klauspost/asmfmt/cmd/asmfmt
    
    Or ran with `go tool <name of tool>`.
    
    ### Rationale for this change
    
    
    ### What changes are included in this PR?
    
    
    ### Are these changes tested?
    
    
    ### Are there any user-facing changes?
    
    Signed-off-by: Sebastiaan van Stijn <[email protected]>
---
 arrow/_tools/tmpl/main.go                  |  9 +++------
 arrow/_tools/tools.go                      | 25 -------------------------
 arrow/compute/datum.go                     |  2 +-
 arrow/compute/doc.go                       |  2 +-
 arrow/compute/internal/kernels/rounding.go |  2 +-
 arrow/compute/internal/kernels/types.go    |  2 +-
 arrow/doc.go                               |  4 ++--
 arrow/tools.go                             | 25 -------------------------
 go.mod                                     | 16 ++++++++++++----
 parquet/doc.go                             |  2 +-
 parquet/internal/utils/_lib/README.md      |  6 +++---
 parquet/tools.go                           | 27 ---------------------------
 12 files changed, 25 insertions(+), 97 deletions(-)

diff --git a/arrow/_tools/tmpl/main.go b/arrow/_tools/tmpl/main.go
index 6fcba97f..b03e2abe 100644
--- a/arrow/_tools/tmpl/main.go
+++ b/arrow/_tools/tmpl/main.go
@@ -97,9 +97,6 @@ func main() {
        }
 
        if *gi {
-               if _, err := exec.LookPath("goimports"); err != nil {
-                       errExit("failed to find goimports: %s", err.Error())
-               }
                formatter = formatSource
        } else {
                formatter = format.Source
@@ -191,14 +188,14 @@ var (
 
 func formatSource(in []byte) ([]byte, error) {
        r := bytes.NewReader(in)
-       cmd := exec.Command("goimports")
+       cmd := exec.Command("go", "tool", "goimports")
        cmd.Stdin = r
        out, err := cmd.Output()
        if err != nil {
                if ee, ok := err.(*exec.ExitError); ok {
-                       return nil, fmt.Errorf("error running goimports: %s", 
string(ee.Stderr))
+                       return nil, fmt.Errorf("error running 'go tool 
goimports': %s", string(ee.Stderr))
                }
-               return nil, fmt.Errorf("error running goimports: %s", 
string(out))
+               return nil, fmt.Errorf("error running 'go tool goimports': %w", 
err)
        }
 
        return out, nil
diff --git a/arrow/_tools/tools.go b/arrow/_tools/tools.go
deleted file mode 100644
index 262880bc..00000000
--- a/arrow/_tools/tools.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build tools
-// +build tools
-
-package _tools
-
-import (
-       _ "golang.org/x/tools/cmd/goimports"
-       _ "golang.org/x/tools/cmd/stringer"
-)
diff --git a/arrow/compute/datum.go b/arrow/compute/datum.go
index 3287d58b..7a296594 100644
--- a/arrow/compute/datum.go
+++ b/arrow/compute/datum.go
@@ -26,7 +26,7 @@ import (
        "github.com/apache/arrow-go/v18/arrow/scalar"
 )
 
-//go:generate go run golang.org/x/tools/cmd/stringer -type=DatumKind 
-linecomment
+//go:generate go tool stringer -type=DatumKind -linecomment
 
 // DatumKind is an enum used for denoting which kind of type a datum is 
encapsulating
 type DatumKind int
diff --git a/arrow/compute/doc.go b/arrow/compute/doc.go
index ee19cd4f..6bb020ca 100644
--- a/arrow/compute/doc.go
+++ b/arrow/compute/doc.go
@@ -26,4 +26,4 @@
 // Everything in this package should be considered Experimental for now.
 package compute
 
-//go:generate stringer -type=FuncKind -linecomment
+//go:generate go tool stringer -type=FuncKind -linecomment
diff --git a/arrow/compute/internal/kernels/rounding.go 
b/arrow/compute/internal/kernels/rounding.go
index 97021298..a0428749 100644
--- a/arrow/compute/internal/kernels/rounding.go
+++ b/arrow/compute/internal/kernels/rounding.go
@@ -31,7 +31,7 @@ import (
        "golang.org/x/exp/constraints"
 )
 
-//go:generate stringer -type=RoundMode
+//go:generate go tool stringer -type=RoundMode
 
 type RoundMode int8
 
diff --git a/arrow/compute/internal/kernels/types.go 
b/arrow/compute/internal/kernels/types.go
index 29cb6f54..12536a61 100644
--- a/arrow/compute/internal/kernels/types.go
+++ b/arrow/compute/internal/kernels/types.go
@@ -57,7 +57,7 @@ var (
                numericTypes...), baseBinaryTypes...)
 )
 
-//go:generate stringer -type=CompareOperator -linecomment
+//go:generate go tool stringer -type=CompareOperator -linecomment
 
 type CompareOperator int8
 
diff --git a/arrow/doc.go b/arrow/doc.go
index c97b0d14..c95ab01c 100644
--- a/arrow/doc.go
+++ b/arrow/doc.go
@@ -42,5 +42,5 @@ const PkgVersion = "18.5.2"
 //go:generate go run ./gen-flatbuffers.go
 
 // stringer
-//go:generate stringer -type=Type
-//go:generate stringer -type=UnionMode -linecomment
+//go:generate go tool stringer -type=Type
+//go:generate go tool stringer -type=UnionMode -linecomment
diff --git a/arrow/tools.go b/arrow/tools.go
deleted file mode 100644
index 37b6dde3..00000000
--- a/arrow/tools.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build tools
-// +build tools
-
-package tools
-
-import (
-       _ "golang.org/x/tools/cmd/goimports"
-       _ "golang.org/x/tools/cmd/stringer"
-)
diff --git a/go.mod b/go.mod
index 3bc2af42..51efd389 100644
--- a/go.mod
+++ b/go.mod
@@ -18,6 +18,14 @@ module github.com/apache/arrow-go/v18
 
 go 1.25.0
 
+tool (
+       github.com/klauspost/asmfmt/cmd/asmfmt
+       github.com/minio/asm2plan9s
+       github.com/minio/c2goasm
+       golang.org/x/tools/cmd/goimports
+       golang.org/x/tools/cmd/stringer
+)
+
 require (
        github.com/andybalholm/brotli v1.2.1
        github.com/apache/thrift v0.22.0
@@ -27,11 +35,8 @@ require (
        github.com/google/flatbuffers v25.12.19+incompatible
        github.com/google/uuid v1.6.0
        github.com/hamba/avro/v2 v2.31.0
-       github.com/klauspost/asmfmt v1.3.2
        github.com/klauspost/compress v1.18.5
        github.com/klauspost/cpuid/v2 v2.3.0
-       github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8
-       github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3
        github.com/pierrec/lz4/v4 v4.1.26
        github.com/pterm/pterm v0.12.83
        github.com/stoewer/go-strcase v1.3.1
@@ -43,7 +48,6 @@ require (
        golang.org/x/exp v0.0.0-20260112195511-716be5621a96
        golang.org/x/sync v0.20.0
        golang.org/x/sys v0.42.0
-       golang.org/x/tools v0.43.0
        golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da
        gonum.org/v1/gonum v0.17.0
        google.golang.org/grpc v1.80.0
@@ -68,10 +72,13 @@ require (
        github.com/golang/snappy v1.0.0 // indirect
        github.com/gookit/color v1.6.0 // indirect
        github.com/json-iterator/go v1.1.12 // indirect
+       github.com/klauspost/asmfmt v1.3.2 // indirect
        github.com/kr/text v0.2.0 // indirect
        github.com/lithammer/fuzzysearch v1.1.8 // indirect
        github.com/mattn/go-isatty v0.0.20 // indirect
        github.com/mattn/go-runewidth v0.0.20 // indirect
+       github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // 
indirect
+       github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect
        github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // 
indirect
        github.com/modern-go/reflect2 v1.0.2 // indirect
        github.com/ncruces/go-strftime v1.0.0 // indirect
@@ -88,6 +95,7 @@ require (
        golang.org/x/telemetry v0.0.0-20260311193753-579e4da9a98c // indirect
        golang.org/x/term v0.41.0 // indirect
        golang.org/x/text v0.35.0 // indirect
+       golang.org/x/tools v0.43.0 // indirect
        google.golang.org/genproto/googleapis/rpc 
v0.0.0-20260120221211-b8f7ae30c516 // indirect
        gopkg.in/yaml.v3 v3.0.1 // indirect
        modernc.org/libc v1.70.0 // indirect
diff --git a/parquet/doc.go b/parquet/doc.go
index 81be5320..edccc3c0 100644
--- a/parquet/doc.go
+++ b/parquet/doc.go
@@ -128,5 +128,5 @@
 //     DECIMAL32, DECIMAL64
 package parquet
 
-//go:generate go run golang.org/x/tools/cmd/stringer -type=Version -linecomment
+//go:generate go tool stringer -type=Version -linecomment
 //go:generate thrift -o internal -r --gen go ../parquet.thrift
diff --git a/parquet/internal/utils/_lib/README.md 
b/parquet/internal/utils/_lib/README.md
index 17c3006a..9017b551 100644
--- a/parquet/internal/utils/_lib/README.md
+++ b/parquet/internal/utils/_lib/README.md
@@ -33,9 +33,9 @@ compatible Go assembly from C assembly.
 First the tools need to be installed:
 
 ```bash
-go install github.com/klauspost/asmfmt/cmd/asmfmt@latest
-go install github.com/minio/asm2plan9s@latest
-go install github.com/minio/c2goasm@latest
+go get -tool github.com/klauspost/asmfmt/cmd/asmfmt
+go get -tool github.com/minio/asm2plan9s
+go get -tool github.com/minio/c2goasm
 ```
 
 ### Generating for amd64
diff --git a/parquet/tools.go b/parquet/tools.go
deleted file mode 100644
index 64e9419e..00000000
--- a/parquet/tools.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build tools
-// +build tools
-
-package tools
-
-import (
-       _ "github.com/klauspost/asmfmt/cmd/asmfmt"
-       _ "github.com/minio/asm2plan9s"
-       _ "github.com/minio/c2goasm"
-       _ "golang.org/x/tools/cmd/stringer"
-)

Reply via email to