Moves main package in module root#2
Conversation
WalkthroughUpdated taskfile.yaml to change SRC_DIR from cmd/log2csv to the repository root, adjusting Go task targets (tidy, deps, fmt, vet, build) to operate at the root. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
taskfile.yaml (1)
68-68: Minor: avoid redundant path prefix in build target.With SRC_DIR=".", ./{{.SRC_DIR}} expands to "./.", which is equivalent to ".". Slight readability win:
- - go build -trimpath -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BIN_NAME}} ./{{.SRC_DIR}} + - go build -trimpath -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BIN_NAME}} {{.SRC_DIR}}(Optional) If on Go ≥ 1.20, you can use -C to pin working dir cleanly:
- - go build -trimpath -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BIN_NAME}} {{.SRC_DIR}} + - go build -C {{.SRC_DIR}} -trimpath -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BIN_NAME}} .
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
taskfile.yaml(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: b4prog
PR: b4prog/Log2CSV#1
File: taskfile.yaml:32-55
Timestamp: 2025-09-09T04:09:07.941Z
Learning: For the Log2CSV project (github.com/b4prog/Log2CSV), the maintainer prefers to keep taskfile.yaml tasks (tidy, deps, fmt, vet, test) running from SRC_DIR rather than the repository root, as Log2CSV is intended to be the only program in the repository.
📚 Learning: 2025-09-09T04:09:07.941Z
Learnt from: b4prog
PR: b4prog/Log2CSV#1
File: taskfile.yaml:32-55
Timestamp: 2025-09-09T04:09:07.941Z
Learning: For the Log2CSV project (github.com/b4prog/Log2CSV), the maintainer prefers to keep taskfile.yaml tasks (tidy, deps, fmt, vet, test) running from SRC_DIR rather than the repository root, as Log2CSV is intended to be the only program in the repository.
Applied to files:
taskfile.yaml
| vars: | ||
| APP_NAME: Log2CSV | ||
| SRC_DIR: cmd/log2csv | ||
| SRC_DIR: . |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Changing SRC_DIR to repository root affects all tooling scopes; verify repo now has a single main at root.
This routes tidy/deps/fmt/vet/test/build to run at ".", which is fine if the module root now contains exactly one package main and no additional mains under subfolders. Please confirm:
- go build ./. yields a single binary (no “multiple packages” error).
- go test -race ./... from root is intended (it will traverse all packages under the module).
Given your earlier preference to keep tasks anchored to SRC_DIR (not the repo root) for flexibility, consider decoupling “module root” from “main package path” to keep future moves frictionless. Example below.
We used your saved preference from prior PR feedback.
vars:
APP_NAME: Log2CSV
- SRC_DIR: .
+ SRC_DIR: . # module root
+ MAIN_PKG: . # path to the main package (can later be 'cmd/log2csv', etc.)
@@
build:
@@
- - go build -trimpath -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BIN_NAME}} ./{{.SRC_DIR}}
+ - go build -trimpath -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BIN_NAME}} {{.MAIN_PKG}}
@@
test:
@@
- - go test -race ./...
+ - go test -race ./...📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| SRC_DIR: . | |
| vars: | |
| APP_NAME: Log2CSV | |
| SRC_DIR: . # module root | |
| MAIN_PKG: . # path to the main package (can later be 'cmd/log2csv', etc.) | |
| build: | |
| commands: | |
| - go build -trimpath -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.BIN_NAME}} {{.MAIN_PKG}} | |
| test: | |
| commands: | |
| - go test -race ./... |
Summary by CodeRabbit