Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: exposing shfmt #1827

Closed
dycw opened this issue Mar 5, 2021 · 2 comments
Closed

Question: exposing shfmt #1827

dycw opened this issue Mar 5, 2021 · 2 comments

Comments

@dycw
Copy link

dycw commented Mar 5, 2021

Hi, I don't have any experience with go, but would like to expose shfmt as a hook. If I define in .pre-commit-hooks.yaml:

 - id: shfmt
   name: shfmt
   entry: shfmt
   language: golang
   types: [shell]
   additional_dependencies: [github.com/mvdan/sh/cmd/shfmt]

which is my attempt at mimicking #1785, I get:

 ❯ pre-commit try-repo . shfmt --verbose --all-files
[WARNING] Creating temporary repo with uncommitted changes...
===============================================================================
Using config:
===============================================================================
repos:
-   repo: /tmp/tmpkb89hypm/shadow-repo
    rev: 6c8fe49ebeca4fee22e23f9ee140e04a89805376
    hooks:
    -   id: shfmt
===============================================================================
[INFO] Initializing environment for /tmp/tmpkb89hypm/shadow-repo.
[INFO] Initializing environment for /tmp/tmpkb89hypm/shadow-repo:github.com/mvdan/sh/cmd/shfmt.
[INFO] Installing environment for /tmp/tmpkb89hypm/shadow-repo.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/usr/local/go/bin/go', 'get', './...')
return code: 1
expected return code: 0
stdout: (none)
stderr:
    go: cannot find main module, but found .git/config in /tmp/tmpkb89hypm/repoxoqgjt0m/golangenv-default/src/unknown_src_dir
        to create a module there, run:
        go mod init

Check the log at /home/derek/.cache/pre-commit/pre-commit.log

No idea what that means. Any help please?

@asottile
Copy link
Member

asottile commented Mar 5, 2021

dupe #1815 -- it'll get released soon, I want to get the R branch in before the next release

@asottile asottile closed this as completed Mar 5, 2021
@dycw
Copy link
Author

dycw commented Mar 6, 2021

Thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants