This repository has been archived by the owner on Jun 29, 2022. It is now read-only.
Create code style guide for Go, Terraform and Helm #883
Labels
kind/documentation
Issues about documentation
To avoid the same discussions over and over on the pull requests, we should create a style guide for Go and Terraform code, which should cover opinionated decisions about the code style in our code base. We should discuss and agree on things which are added here, to make sure everyone is satisfied and is comfortable following those style guides.
The style guide should include aspects, which are not covered by the linters. However, if we get time to do so, we could implement the style guide in a linter to make sure it is enforced automatically.
Some items, which could go there:
fmt.Errorf
overerrors.New()
orerrors.Wrapf()
(Update error wrapping to new Golang conventions #59)fmt.Errorf()
unless function returns error only once.if
statement, iferr
is the only parameter assigned, unless it violates line length linter recommendations.HasErrors()
method.//nolint:foo
vs// nolint:foo
vs// nolint: foo
t.Fatalf("failed to bla")
vst.Fatalf("Failed to bla")
)//nolint: funlen
inlined with function declarationmake
for initializing slices.CC @iaguis
The text was updated successfully, but these errors were encountered: