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 Go toolchain install command #70

Closed
svengreb opened this issue Apr 21, 2021 · 0 comments · Fixed by #71
Closed

Task for Go toolchain install command #70

svengreb opened this issue Apr 21, 2021 · 0 comments · Fixed by #71

Comments

@svengreb
Copy link
Owner

svengreb commented Apr 21, 2021

As of Go version 1.16 go install $pkg@$version allows to install commands without affecting the main module. Additionally commands like go build and go test no longer modify go.mod and go.sum files by default but report an error if a module requirement or checksum needs to be added or updated (as if the -mod=readonly flag were used).
This can be used as alternative to the already existing gobin runner.

To support the go install command of the Go toolchain, a new Task will be implemented in a new install package that can be used through a Go toolchain Runner.
The task will be customizable through the following functions:

  • WithEnv(env map[string]string) install.Option — sets the task specific environment.
  • WithModulePath(path string) install.Option — sets the module import path.
  • WithModuleVersion(version *semver.Version) install.Option — sets the module version.
@svengreb svengreb self-assigned this Apr 21, 2021
@svengreb svengreb added this to the 0.5.0 milestone Apr 21, 2021
svengreb added a commit that referenced this issue Apr 21, 2021
As of Go version 1.16 `go install $pkg@$version` [1] allows to install
commands without affecting the `main` module. Additionally commands
like `go build` and `go test` no longer modify `go.mod` and `go.sum`
files by default but report an error if a module requirement or checksum
needs to be added or updated (as if the `-mod=readonly` flag were used).
This can be used as alternative to the already existing `gobin` runner
[2].

To support the `go install` command of the Go toolchain [3], a new
`Task` [4] has been implemented in the new `install` [5] package that
can be used through a Go toolchain `Runner` [6].
The task is customizable through the following functions:

- `WithEnv(env map[string]string) install.Option` - sets the task
  specific environment.
- `WithModulePath(path string) install.Option` - sets the module import
  path.
- `WithModuleVersion(version *semver.Version) install.Option` - sets the
  module version.

[1]: https://blog.golang.org/go116-module-changes#TOC_4.
[2]: https://pkg.go.dev/github.com/svengreb/wand@v0.4.1/pkg/task/gobin
[3]: https://pkg.go.dev/cmd/go#hdr-Compile_and_install_packages_and_dependencies
[4]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task#Task
[5]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task/golang/install
[6]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task/golang#Runner

GH-70
svengreb added a commit that referenced this issue Apr 21, 2021
As of Go version 1.16 `go install $pkg@$version` [1] allows to install
commands without affecting the `main` module. Additionally commands
like `go build` and `go test` no longer modify `go.mod` and `go.sum`
files by default but report an error if a module requirement or checksum
needs to be added or updated (as if the `-mod=readonly` flag were used).
This can be used as alternative to the already existing `gobin` runner
[2].

To support the `go install` command of the Go toolchain [3], a new
`Task` [4] has been implemented in the new `install` [5] package that
can be used through a Go toolchain `Runner` [6].
The task is customizable through the following functions:

- `WithEnv(env map[string]string) install.Option` - sets the task
  specific environment.
- `WithModulePath(path string) install.Option` - sets the module import
  path.
- `WithModuleVersion(version *semver.Version) install.Option` - sets the
  module version.

[1]: https://blog.golang.org/go116-module-changes#TOC_4.
[2]: https://pkg.go.dev/github.com/svengreb/wand@v0.4.1/pkg/task/gobin
[3]: https://pkg.go.dev/cmd/go#hdr-Compile_and_install_packages_and_dependencies
[4]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task#Task
[5]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task/golang/install
[6]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task/golang#Runner

Closes GH-70
@svengreb svengreb removed their assignment Apr 21, 2021
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