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

Task for “mvdan.cc/gofumpt“ Go module command #56

Closed
svengreb opened this issue Dec 11, 2020 · 0 comments · Fixed by #57
Closed

Task for “mvdan.cc/gofumpt“ Go module command #56

svengreb opened this issue Dec 11, 2020 · 0 comments · Fixed by #57

Comments

@svengreb
Copy link
Owner

svengreb commented Dec 11, 2020

The mvdan.cc/gofumpt Go module provides the gofumpt command, a tool that enforces a stricter format than gofmt and provides additional rules, while being backwards compatible. It is a modified fork of gofmt so it can be used as a drop-in replacement.

To configure and run the gofumpt command, a new task.GoModule will be implemented in a new gofumpt package that can be run using the gobin command runner or any other command runner that handles tasks of kind KindGoModule.

The task will be customizable through the following functions:

  • WithEnv(map[string]string) gofumpt.Option — sets the task specific environment.
  • WithExtraArgs(...string) gofumpt.Option — sets additional arguments to pass to the command.
  • WithExtraRules(bool) gofumpt.Option — indicates whether gofumpt‘s extra rules should be enabled. See the repository documentation for a listing of available rules.
  • WithListNonCompliantFiles(bool) gofumpt.Option — indicates whether files, whose formatting are not conform to the style guide, are listed.
  • WithModulePath(string) gofumpt.Option — sets the module import path.
  • WithModuleVersion(*semver.Version) gofumpt.Option — sets the module version.
  • WithPaths(...string) gofumpt.Option — sets the paths to search for Go source files. By default all directories are scanned recursively starting from the current working directory.
  • WithReportAllErrors(bool) gofumpt.Option — indicates whether all errors should be printed instead of only the first 10 on different lines.
  • WithSimplify(bool) gofumpt.Option — indicates whether code should be simplified.

The “elder“ reference implementation will provide a new Gofumpt method.

@svengreb svengreb added this to the Next milestone Dec 11, 2020
@svengreb svengreb self-assigned this Dec 11, 2020
svengreb added a commit that referenced this issue Dec 11, 2020
The "mvdan.cc/gofumpt" [1] Go module provides the `gofumpt` command,
a tool that enforces a stricter format than
"https://pkg.go.dev/cmd/gofmt" and provides additional rules [2],
while being backwards compatible.
It is a modified fork of "https://pkg.go.dev/cmd/gofmt" so it can be
used as a drop-in replacement.

To configure and run the `gofumpt` command, a new `task.GoModule` [3]
has been implemented in the new "gofumpt" [4] package that can be run
using the "gobin" command runner [5] or any other command runner [6]
that handles tasks of kind `KindGoModule` [7].

The task is customizable through the following functions:

- `WithEnv(map[string]string) gofumpt.Option` - sets the task specific
  environment.
- `WithExtraArgs(...string) gofumpt.Option` - sets additional arguments
  to pass to the command.
- `WithExtraRules(bool) gofumpt.Option` - indicates whether gofumpt's
  extra rules should be enabled. See the [repository documentation for a
  listing of available rules][2].
- `WithListNonCompliantFiles(bool) gofumpt.Option` - indicates whether
  files, whose formatting are not conform to the style guide, are
  listed.
- `WithModulePath(string) gofumpt.Option` - sets the module import path.
- `WithModuleVersion(*semver.Version) gofumpt.Option` - sets the module
  version.
- `WithPaths(...string) gofumpt.Option` - sets the paths to search for
  Go source files. By default all directories are scanned recursively
  starting from the current working directory.
- `WithReportAllErrors(bool) gofumpt.Option` - indicates whether all
  errors should be printed instead of only the first 10 on different
  lines.
- `WithSimplify(bool) gofumpt.Option` - indicates whether code should
  be simplified.

The "elder" reference implementation provides the new `Gofumpt`
method [8].

[1]: https://pkg.go.dev/mvdan.cc/gofumpt
[2]: https://github.com/mvdan/gofumpt#added-rules
[3]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task#GoModule
[4]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task/gofumpt
[5]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task/gobin#Runner
[6]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task#Runner
[7]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task#KindGoModule
[8]: https://pkg.go.dev/github.com/svengreb/wand/pkg/elder#Elder.Gofumpt

GH-56
svengreb added a commit that referenced this issue Dec 11, 2020
The "mvdan.cc/gofumpt" [1] Go module provides the `gofumpt` command,
a tool that enforces a stricter format than
"https://pkg.go.dev/cmd/gofmt" and provides additional rules [2],
while being backwards compatible.
It is a modified fork of "https://pkg.go.dev/cmd/gofmt" so it can be
used as a drop-in replacement.

To configure and run the `gofumpt` command, a new `task.GoModule` [3]
has been implemented in the new "gofumpt" [4] package that can be run
using the "gobin" command runner [5] or any other command runner [6]
that handles tasks of kind `KindGoModule` [7].

The task is customizable through the following functions:

- `WithEnv(map[string]string) gofumpt.Option` - sets the task specific
  environment.
- `WithExtraArgs(...string) gofumpt.Option` - sets additional arguments
  to pass to the command.
- `WithExtraRules(bool) gofumpt.Option` - indicates whether gofumpt's
  extra rules should be enabled. See the [repository documentation for a
  listing of available rules][2].
- `WithListNonCompliantFiles(bool) gofumpt.Option` - indicates whether
  files, whose formatting are not conform to the style guide, are
  listed.
- `WithModulePath(string) gofumpt.Option` - sets the module import path.
- `WithModuleVersion(*semver.Version) gofumpt.Option` - sets the module
  version.
- `WithPaths(...string) gofumpt.Option` - sets the paths to search for
  Go source files. By default all directories are scanned recursively
  starting from the current working directory.
- `WithReportAllErrors(bool) gofumpt.Option` - indicates whether all
  errors should be printed instead of only the first 10 on different
  lines.
- `WithSimplify(bool) gofumpt.Option` - indicates whether code should
  be simplified.

The "elder" reference implementation provides the new `Gofumpt`
method [8].

[1]: https://pkg.go.dev/mvdan.cc/gofumpt
[2]: https://github.com/mvdan/gofumpt#added-rules
[3]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task#GoModule
[4]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task/gofumpt
[5]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task/gobin#Runner
[6]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task#Runner
[7]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task#KindGoModule
[8]: https://pkg.go.dev/github.com/svengreb/wand/pkg/elder#Elder.Gofumpt

Closes GH-56
@svengreb svengreb removed their assignment Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant