mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 15:47:14 +01:00
With Go 1.14 the handling of modules has improved in the sense that all the subcommands `go {test, generate}` now use the vendor when available by default. This makes it easier for us to run generate using the vendored tools like controller-tools etc. as it now uses the checked in vendor.
1.3 KiB
1.3 KiB
Managing Dependencies
Build Dependencies
The following dependencies must be installed on your system before you can build the installer.
Fedora, CentOS, RHEL
sudo yum install golang-bin gcc-c++
If you need support for libvirt destroy, you should also install libvirt-devel.
Go
We follow a hard flattening approach; i.e. direct and inherited dependencies are installed in the base vendor/.
Dependencies are managed with Go Modules but committed directly to the repository.
We require at least Go 1.14.
- Add or update a dependency with
go get <dependency>@<version>. - If you want to use a fork of a project or ensure that a dependency is not updated even when another dependency requires a newer version of it, manually add a replace directive in the go.mod file.
- Run
go mod tidyto tidygo.modand updatego.sum, then commit the changes. - Run
go mod vendorto re-vendor and then commit updated vendored code separately.
This guide is a great source to learn more about using go mod.
For the sake of your fellow reviewers, commit vendored code separately from any other changes.