Prepare the Go development environment.
The latest Go version is required, which is currently 1.14.x.
Register at GitHub.
Configure two-factor authentication to activate your GitHub account.
Fork an official repository.
Fork the master branch of the official repository to your account.
Use git clone
to clone the repository under your account to a local path.
Run the following command to clone.
git clone https://github.com/your-github-name/terraform-provider-tencentcloud
Complete the routine check.
Run the following command to complete the check before committing.
make hooks
Check out the branch.
Check whether the branch format is type/module-keyword
; for example, feat/tke-support-addon
indicates that the addon feature is added to the TKE module.
Modify the code.
See Code Style for consistency with the existing style.
Modify the test case.
If there are modifications, make sure that all the test cases are accurate and passed.
Implement automatic document generation.
Run the following command to automate document generation. Your code must conform to certain rules as detailed in Terraform docs generator.
make doc
Commit the code.
Run the following command to commit the code. Make sure that the committed messages are as clear and standard as possible.
git commit
Push the code.
Run the following command to push the code to the repository under your account.
git push
Commit the pull request.
It is not allowed to merge the code directly to the official repository without PR + code review.
Notify others for code review.
The code can be merged after approval by at least one member. You are not allowed to merge the code committed by yourself.
Release versions regularly.
Plugins will be updated and features will take effect only after version release.
Constrain the code style as instructed in Go Code Review Comments:
num := a + b
, except when they are used as input or array subscripts.else
after the if
statement returns a value.9
(for Singapore); instead, use a constant, such as const AP_SINGAPORE = 9
.NoteYou can format code with the
make fmt
command. You must runmake hooks
containing a formatting step mentioned in the development steps.
Version names should follow the principles of Semver and be prefixed with v
, such as v1.2.3
.
You must update CHANGELOG.md
upon every modification according to the following versioning rules:
According to the Semver master/sub/patch rules above, release a 1.X.0 subversion for FEATURES and DEPRECATED, and release a 1.0.X patch for ENHANCEMENTS and BUG FIXES.
When users access Tencent Cloud services, you often need to limit the input arguments. For example, you need to limit the selectable database versions when a user purchases a TencentDB for PostgreSQL instance. As the list of supported database versions is updated from time to time, without a timely update, the user may not be able to select the latest version, preventing normal use of the service. In this case, the list should not be specified directly in the code; instead, it should be dynamically pulled through an API.
This principle also applies to versions and memory specifications supported by TencentDB for PostgreSQL and TencentDB for Redis as well as programming languages and versions supported by SCF.
Was this page helpful?