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

Remove magefile? #299

Open
theseion opened this issue May 11, 2024 · 3 comments
Open

Remove magefile? #299

theseion opened this issue May 11, 2024 · 3 comments

Comments

@theseion
Copy link
Collaborator

@fzipi I really don't like the magefile approach. It may be flexible but it doesn't play nice with pre-commit, for example. One issue that leads to is that we have a lot of commits where we reorder imports, depending on whether we ran mage or not.

Another issue: VS Code by default updates import order on save, so changing the order with mage and gosimport is only temporary.

@fzipi
Copy link
Member

fzipi commented May 11, 2024

Well, I normally use Goland. How do we keep things consistent?

@theseion
Copy link
Collaborator Author

Not sure. I tried running mage as a pre-commit program but that doesn't really work because of auto staging. Honestly, pre-commit is fine but it's a pain if it's not in line with what the CI runs.

The CI runs:

  • SonarCloud for static analysis
  • go test for tests

pre-commit runs:
- go-fmt
- go-vet-mod
- go-imports
- golangci-lint-mod
- go-critic
- go-test-mod
- go-build-mod
- go-mod-tidy
- go-cyclo
- gitleaks
- end-of-file-fixer
- trailing-whitespace

mage runs:

  • addlicense
  • golangci-lint
  • gosimports
  • gci
  • gocyclo

mage can also run (I've never done that):

  • godoc
  • go test with coverage

IMO, most of what pre-commit does is good and should also be part of the CI. gosimports is probably better for us than goimports, so I'd also add that to the CI and remove goimports from pre-commit. addlicense should probably also go in the CI; not sure about gci.

We could of course do all that with mage and simply run mage in the CI. I'm not a fan but maybe that's the way to go.

@fzipi
Copy link
Member

fzipi commented Jun 1, 2024

Have no problems either way.

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

2 participants