Skip to content

Moves main package in module root#2

Merged
b4prog merged 1 commit into
mainfrom
move-main-package-in-module-root
Sep 10, 2025
Merged

Moves main package in module root#2
b4prog merged 1 commit into
mainfrom
move-main-package-in-module-root

Conversation

@b4prog

@b4prog b4prog commented Sep 10, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores
    • Standardized the project’s build context to the repository root, streamlining formatting, dependency management, vetting, and build steps.
    • Simplifies local development and CI by running all tooling from a single location, reducing path-related inconsistencies.
    • No user-facing changes; application behavior remains unchanged.

@coderabbitai

coderabbitai Bot commented Sep 10, 2025

Copy link
Copy Markdown

Walkthrough

Updated 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

Cohort / File(s) Summary of Changes
Task automation config
taskfile.yaml
Set SRC_DIR to . instead of cmd/log2csv; updated Go task commands to run at repo root (e.g., go build ./ instead of ./cmd/log2csv).

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.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

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
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch move-main-package-in-module-root

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@b4prog b4prog marked this pull request as ready for review September 10, 2025 04:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 96a5ad4 and c41a23b.

📒 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

Comment thread taskfile.yaml
vars:
APP_NAME: Log2CSV
SRC_DIR: cmd/log2csv
SRC_DIR: .

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.

Suggested change
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 ./...

@b4prog b4prog merged commit 5524c99 into main Sep 10, 2025
3 checks passed
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.

1 participant