An Enovate Wiki
Attachments
History
Blame
View Source
Changelog
Documentation
About An Otter Wiki
Toggle dark mode
Login
Home
A - Z
Page Index
CMMI
Governance
Template
Statement Of Work
Guidelines
Coding Standard
Android Coding Standards
Core Java
Front-End Styling (CSS)
Golang
iOS Coding Standard (Swift)
Java EE
Javascript
Python
Request structure guidelines
Scala
TypeScript
Product Integration
Practical Training PPT
Procedure
Configuration Management (CM)
Estimating (EST)
Managing Performance and Measurement (MPM)
Monitoring and Control (MC)
Peer Review (PR)
Planning (PLAN)
Process Management (PCM)
Process Quality Assurance (PQA)
Product Integration (PI)
Requirement Development Management(RDM)
Risk and Opportunity Management
Technical Solution (TS)
Verification and Validation (VV)
Process Areas
Process Areas - Documents & Evidences
Standard
Document Creation
Naming Convention Standard
Templates
Audit Plan
LLD
Enovate Tools
EnovateIT
Company Profile & Website Portfolio
Home
Local AI
Projects
Audit-matic
HLD
CommNet
Face Recognation
Document
Flowcast
Enovate IT-QMS-PL01-Project Plan-[FlowCast]-V10
HireGenius
SRS
Technical Document (LLD+HLD))
OptiQA
Sentify
SkillShift
HLD
LLD
Social Media Manager
Teams
Team Apex
Team Catalyst
Team Fusion
Team Nova
Team Orbit
Team Pulse
Team Quantum
Team Spark
Team Vision
Templates
Project Template
Team Template
CMMI
Guidelines
Coding Standard
Golang
c07c44
Commit
c07c44
2026-01-16 09:45:03
Melisha Dsouza
: GoLang
CMMI/Guidelines/Coding Standard/Golang.md
..
@@ 18,7 18,7 @@
### **2. Project Layout & Structure**
We adhere to the community-standard **Go Project Layout**.
-
```
+
```Golang
| Directory | Purpose |
| /cmd | Main applications. Directory names match the binary (e.g., cmd/api-server). |
| /internal | Private application and library code. Compiler-enforced privacy. |
@@ 41,7 41,7 @@
2. Third-party packages
3. Internal/Company packages
-
```
+
```Golang
import (
"fmt"
"os"
@@ 77,7 77,7 @@
Avoid global state. Dependencies should be injected explicitly, typically via the constructor.
**Bad (Global State):**
-
```
+
```Golang
func CreateUser() {
db.Execute(...) // "db" is a global variable
}
@@ 105,7 105,7 @@
#### **6.1 Inspectable Errors**
- Never use panic for standard error flow.
- Use %w to wrap errors to add context while preserving type.
-
```
+
```Golang
if err := db.Query(); err != nil {
return fmt.Errorf("querying user failed: %w", err)
}
@@ 118,7 118,7 @@
#### **6.3 Indentation (Line of Sight)**
Handle errors early and return. Avoid else blocks after error checks.
-
```
+
```Golang
// Bad
if err == nil {
// heavy logic
@@ 157,7 157,7 @@
- **Note**: Passing by value is often faster due to stack allocation logic.
#### **8.2 Slice Allocation**
If the length is known, pre-allocate slices to avoid resizing overhead.
-
```
+
```Golang
// Good
users := make([]User, 0, len(ids))
```
@@ 165,7 165,7 @@
### **9. Testing**
#### **9.1 Table-Driven Tests**
Use table-driven tests for all logic-heavy functions.
-
```
+
```Golang
func TestAdd(t *testing.T) {
tests := []struct {
name string
@@ 216,3 216,5 @@
- noctx # finds sending http request without context.Context
- revive # fast, configurable, extensible, flexible, and beautiful linter
```
+
+
**Document** - [Go Lang](https://docs.google.com/document/d/1EaOaSk-hbuje0igvIxl1DXcHQROc3KP-S49eD1IUGqg/edit?usp=sharing)
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9