Linting tool trunk
seems to hang and it's probably related to aqua proxy
#2025
Unanswered
sheldonhull
asked this question in
Support Request
Replies: 1 comment 6 replies
-
I'm not familiar with trunk, and I don't understand what is trunk and how trunk is related to aqua. I install trunk and try to reproduce the issue on my macOS (darwin/amd64). https://docs.trunk.io/docs/install#with-homebrew-macos-only $ brew install trunk-io
$ trunk --version
1.10.0
$ aqua -v
aqua version 2.7.0 (12ad6be65e139f389975d23b34f735a0ff5a59d0) $ which go
/Users/shunsuke-suzuki/.local/share/aquaproj-aqua/bin/go
$ which golangci-lint
/Users/shunsuke-suzuki/.local/share/aquaproj-aqua/bin/golangci-lint
$ go version
go version go1.20.4 darwin/amd64
$ golangci-lint version
golangci-lint has version 1.52.2 built with go1.20.2 from da04413a on 2023-03-25T18:11:28Z mkdir trunk-test
cd trunk-test
git init
echo 'test readme.md' > README.md
go mod init dev.local
go mod tidy
aqua init
git add .
git commit -m "chore: initial commit" aqua g -i golang/[email protected] golangci/[email protected]
aqua i $ ls -A
.git README.md aqua.yaml go.mod
$ git status
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: aqua.yaml $ trunk init
trunk init
Initializing 100% [=================================================================================================================================================>] 9/9 1.4s
Formatting Configs 100% [===========================================================================================================================================>] 7/7 0.5s
✔ 5 linters were enabled (.trunk/trunk.yaml)
git-diff-check (5 files)
gitleaks 8.16.3 (5 files)
markdownlint 0.34.0 (1 markdown file) (created .markdownlint.yaml)
prettier 2.8.8 (1 markdown, 2 yaml files)
yamllint 1.32.0 (2 yaml files) (created .yamllint.yaml)
→ Would you like Trunk to manage your git hooks? (Y/n):
→ Run 'trunk fmt' whenever you run 'git commit'? (Y/n):
→ Run 'trunk check' whenever you run 'git push'? (Y/n):
✔ 3 actions were enabled (.trunk/trunk.yaml)
trunk-announce
trunk-check-pre-push
trunk-fmt-pre-commit
✔ Trunk is now managing your git hooks (https://docs.trunk.io for more info)
→ Would you like to sample current linter issues in your repo? (Y/n):
Running trunk check --sample 5
Checking 100% [===================================================================================================================================================>] 33/33 1.0s
AUTOFIXES
aqua.yaml
1:1 high Incorrect formatting
8 | # - all
9 | registries:
10 | - type: standard
11 | ref: v4.9.0 # renovate: depName=aquaproj/aqua-registry
| - type: standard
| ref: v4.9.0 # renovate: depName=aquaproj/aqua-registry
12 | packages:
13 | - name: golang/[email protected]
14 | - name: golangci/[email protected]
| - name: golang/[email protected]
| - name: golangci/[email protected]
ISSUES
README.md:1:0
1:0 low First line in a file should be a top-level heading markdownlint/MD041
aqua.yaml
-:- fmt Incorrect formatting, autoformat by running 'trunk fmt' prettier
Checked 7 files
✖ 2 issues (1 auto-fixable)
Next Steps
1. Read documentation
Our documentation can be found at https://docs.trunk.io
2. Get help and give feedback
Join the Trunk community at https://slack.trunk.io $ trunk install
trunk install
Installing 100% [===================================================================================================================================================>] 7/7 0.2s
✔ Done https://docs.trunk.io/docs/reference-trunk-yaml $ cat .trunk/trunk.yaml
version: 0.1
cli:
version: 1.10.0
plugins:
sources:
- id: trunk
ref: v0.0.17
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- git-diff-check
- [email protected]
- [email protected]
- [email protected]
- [email protected]
runtimes:
enabled:
- [email protected]
- [email protected]
- [email protected]
actions:
enabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
- trunk-upgrade-available
I can't find golangci-lint in my .trunk/trunk.yaml 🤔 |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
aqua version
aqua version 2.7.0 (12ad6be65e139f389975d23b34f735a0ff5a59d0)
Environment
Overview
trunk.io is a great linting toolchain for pre-commit and pre-push.
I've run into some odd issues that seem related to being stuck when trying to invoke certain commands using the system Go install (aka aqua managed) vs the "hermetically sealed" Go that trunk would install.
This adds more setup time and I prefer to simplify the management by using Aqua for Go + golangci-lint instead of double installing via trunk.
How to reproduce
Now run:
trunk init
and it should setup latest in the repo.aqua generate golang/[email protected] && aqua generate -i golangci/[email protected] && aqua i
trunk init
andtrunk install
should work without hanging.Since we have the tools installed now, open
trunk.yaml
.Find the [email protected] and replace the version with
SYSTEM
string so it tries to use whatever our profile has in PATH.Then do the same for the runtimes that mention
[email protected]
or whatever and putgo@SYSTEM
.I get go tooling hanging without any resolution and
htop --filter=go
showsgo install ....
just stuck or looping (didn't confirm process id changed), and tool indefinitely won't work.Debug output
No response
Expected behaviour
I should be able to use tooling managed by Go with trunk.
Actual behaviour
I can't tell if it's a trunk issue (they are stumped right now), or what feels more likely is some type of issue with the proxyed request coming through not from me, but from another process invoking (and I confirmed it's not doing a subshell, should be respecting my session).
The only thing that makes me suspicious that trunk invocation isn't calling in the context of my current session is the caller seems to be bash instead of trunk...
Important Factoids
This is a bit more complex of an issue, but I want to bring it up as the only two issues I think I've seen based on the incredible design of aqua are:
I think aqua proxying requests is an ingenious design, so I think working through this and having some good answers for cases that can't be fixed or what to look for will help further increase the ease of adoption when bumps come along.
Please don't consider this urgent, but I'd like to do this as a investigation together to improve aqua further.
Reference
Beta Was this translation helpful? Give feedback.
All reactions