CRDB Guide #45

Open
opened 2021-06-20 21:30:02 +00:00 by jeff · 0 comments
Owner

https://wiki.crdb.io/wiki/spaces/CRDB/pages/181371303/Go+Golang+coding+guidelines

Don't panic.

strconv is faster than fmt.Sprintf.

Group related declarations (const, var, import, etc).

Reduce nesting.

Avoid unnecessary else statements.

Use fields names to initialize structs.

Use := to declare variables, unless declaring the zero value.

Minimize the scope of variables.

Use the most specific fmt verb for the value.

Use Raw String Literals to Avoid Escaping.

https://wiki.crdb.io/wiki/spaces/CRDB/pages/181371303/Go+Golang+coding+guidelines Don't panic. strconv is faster than fmt.Sprintf. Group related declarations (const, var, import, etc). Reduce nesting. Avoid unnecessary else statements. Use fields names to initialize structs. Use `:=` to declare variables, unless declaring the zero value. Minimize the scope of variables. Use the most specific fmt verb for the value. Use Raw String Literals to Avoid Escaping.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: simplesystems/go-resources#45
No description provided.