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.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

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