Skip to content

Support 'go install ./...' ? #297

@adamchainz

Description

@adamchainz

The current .pre-commit-hooks.yaml file allows running actionlint through pre-commit's system and docker languages. These are both ways of skipping pre-commit's packaging system.

pre-commit has a golang language, and in recent version 3.0.0 it gained the ability to bootstrap golang. This allows users to compile and run native golang tools without any setup other than pre-commit. It would be neat if actionlint supported this style of running, since it would avoid teams needing to all install actionlint themselves, or Docker.

I just tried using actionlint under pre-commit with golang, just this change:

--- .pre-commit-hooks.yaml
+++ .pre-commit-hooks.yaml
@@ -2,7 +2,7 @@
 - id: actionlint
   name: Lint GitHub Actions workflow files
   description: Runs actionlint to lint GitHub Actions workflow files
-  language: system
+  language: golang
   types: ["yaml"]
   files: "^.github/workflows/"
   entry: actionlint

It fails though, with:

An unexpected error has occurred: CalledProcessError: command: ('/opt/homebrew/bin/go', 'install', './...')
return code: 1
stdout: (none)
stderr:
    go: downloading github.com/yuin/goldmark v1.5.4
    go: downloading gopkg.in/yaml.v3 v3.0.1
    go: downloading github.com/fatih/color v1.15.0
    go: downloading github.com/mattn/go-colorable v0.1.13
    go: downloading github.com/mattn/go-runewidth v0.0.14
    go: downloading github.com/robfig/cron v1.2.0
    go: downloading golang.org/x/sync v0.1.0
    go: downloading golang.org/x/sys v0.6.0
    go: downloading github.com/mattn/go-isatty v0.0.18
    go: downloading github.com/rivo/uniseg v0.4.4
    package github.com/rhysd/actionlint/playground
    	imports syscall/js: build constraints exclude all Go files in /opt/homebrew/Cellar/go/1.20.3/libexec/src/syscall/js

pre-commit runs go install ./..., but this fails in the actinolint repo. I'm afraid I don't know anything about Go, so that's where I stop. I imagine the repository may need a little rearrangement, or a rule added to not install the playground by default... Anyway I would just like to see this happen to make it a little bit easier to run actionlint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions