j178 commented on code in PR #54615:
URL: https://github.com/apache/airflow/pull/54615#discussion_r2328122256


##########
go-sdk/.pre-commit-config.yaml:
##########
@@ -0,0 +1,73 @@
+# 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.
+---
+default_stages: [pre-commit, pre-push]
+default_language_version:
+  golang: 1.24.0
+minimum_prek_version: '0.0.28'
+repos:
+  - repo: meta
+    hooks:
+      - id: identity
+        name: Print checked files
+        description: Print input to the static check hooks for troubleshooting
+      - id: check-hooks-apply
+        name: Check if all hooks apply to the repository
+  - repo: https://github.com/Lucas-C/pre-commit-hooks
+    # replace hash with version once PR #103 merged comes in a release
+    rev: abdd8b62891099da34162217ecb3872d22184a51
+    hooks:
+      - id: insert-license
+        name: Add license for all Go files
+        types: [go]
+        exclude: mocks/.*\.go$
+        args:
+          - --comment-style
+          - "|//|"
+          - --license-filepath
+          - ../scripts/ci/license-templates/LICENSE.txt
+          - --insert-license-after-regex
+          # We need this 'generated by' line at the top for `golines` to not 
format it
+          - '// Code generated by .*'
+  - repo: local
+    hooks:
+      - id: go-mockery
+        name: Generate mocks for go
+        entry: -w /src/go-sdk vektra/mockery:3
+        exclude: mocks/.*\.go$
+        types: [go]
+        pass_filenames: false
+        language: docker_image
+      - id: go-mod-tidy
+        name: Run go mod tidy
+        entry: go mod tidy
+        types: [go]
+        exclude: mocks/.*\.go$
+        pass_filenames: false
+        language: golang
+      - id: gofmt
+        name: Format go code
+        entry: golines --base-formatter=gofumpt --write-output --max-len=100 
--chain-split-dots
+        additional_dependencies: [github.com/segmentio/golines@latest, 
mvdan.cc/gofumpt@v0.8.0]
+        types: [go]
+        language: golang
+      - id: gci
+        name: Consistent import ordering for Go files
+        entry: gci write --skip-generated -s standard -s default

Review Comment:
   ```suggestion
           entry: gci write --skip-generated -s standard -s default -s 
localmodule
   ```
   
   I think `-s localmodule` is required to fix 
https://github.com/apache/airflow/pull/54615/files#r2282921798



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to