Skip to content

Add warning when zen.tool.go does not exist in main package - #414

Merged
bitterpanda63 merged 1 commit into
mainfrom
warn-no-zen-tool
Apr 19, 2026
Merged

Add warning when zen.tool.go does not exist in main package#414
bitterpanda63 merged 1 commit into
mainfrom
warn-no-zen-tool

Conversation

@tomaisthorpe

@tomaisthorpe tomaisthorpe commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

zen.tool.go must be in the same folder as the main package, if it's not there, it can create linker issues which are not obvious. Added a warning to help diagnose the problem.

Example:

❯ go build -toolexec="zen-go toolexec" -o app ./cmd
# myapp/cmd
zen-go: warning: zen.tool.go not found in cmd. zen.tool.go must be in the same directory as your main package. Run 'zen-go init' from that directory to set up instrumentation.
# myapp/cmd
cannot find package github.com/AikidoSec/firewall-go/instrumentation/sources/labstack/echo.v4 (using -importcfg)
/opt/homebrew/Cellar/go/1.26.1/libexec/pkg/tool/darwin_arm64/link: cannot open file : open : no such file or directory
exit status 2

Summary by Aikido

Security Issues: 0 🔍 Quality Issues: 1 Resolved Issues: 0

⚡ Enhancements

  • Emitted warning when zen.tool.go missing from main package build.
  • Modified checkZenToolFileIncluded to accept stderr and print warnings.

More info

Comment thread cmd/zen-go/cmd_toolexec_compile.go
@bitterpanda63
bitterpanda63 merged commit b1630e0 into main Apr 19, 2026
77 of 81 checks passed
@tomaisthorpe
tomaisthorpe deleted the warn-no-zen-tool branch June 2, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants