Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve default task configuration #153

Open
techfg opened this issue Feb 2, 2025 · 0 comments
Open

improve default task configuration #153

techfg opened this issue Feb 2, 2025 · 0 comments

Comments

@techfg
Copy link

techfg commented Feb 2, 2025

Solution you'd like

Currently, the default tasks (e.g., build, test, lint, etc.) generated by @nx-go have a few limitations/issues:

  1. go.work is not included in default inputs (see Go apps affecting projects incorrectly #134) - this results in changes to go.work not "affecting" go projects
  2. go.work.sum is not included in default inputs - this results in changes to go.work not "affecting" go projects
  3. Caching is not enabled by default for build/test/lint - this results in go project tasks re-executing (e.g., run-many -t build) when nothing has changed
  4. Task inputs/outputs are not defined - this results in not incorporating common nx namedInputs such as sharedGlobals, defaults, etc.

@nx-go is a plug-in and infers project dependencies and should therefore infer reasonable defaults for cache/inputs/outputs. While separate from #152 which contemplates inferred tasks themselves, the inferred defaults for @nx-go/nx-go:build, @nx-go/nx-go:test, etc. are related.

I believe the following are reasonable defaults to consider for build/test/lint:

{
   "inputs": [
      "{projectRoot}/go.mod",
      "{projectRoot}/go.sum",
      "{projectRoot}/**/*.go",      
      "{workspaceRoot}/go.work",
      "{workspaceRoot}/go.work.sum",
      "^production", // if the named input exists
      "sharedGlobals" // if the namedInput exists
   ],
   "cache": true,
   "outputs": [
      "{options.outputPath}" // for build only
   ]
}

Appreciate the consideration and feedback/input welcomed!

Is your feature request related to a problem?

#134

Alternatives you've considered

Manually defining/adjusting targets achieves the desired outcome.

Additional Information

See related issues #134 & #152

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

No branches or pull requests

1 participant