[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/tech/ - Technical SEO

Site architecture, schema markup & core web vitals
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1776086554005.jpg (114.09 KB, 1080x708, img_1776086544818_qa7vqbna.jpg)ImgOps Exif Google Yandex

ce945 No.1480

lately i was going through over a thousand pull requests on github for projects written mostly with golang. same stuff keeps popping up again and agin, like err!= nil checks scattered across the place or god-objects (functions doing everything) that stretch into hundreds of lines ⭐

when you first start coding in go it feels so natural to just dive right back at old habits from java/python land ♂️. i mean who doesnt love a big ol' function with every conceivable task jammed inside? but as the codebase grows, those if statements and spaghetti functions become more of an eyesore than anything else ⚡

so heres my takeaway: break your logic into smaller chunks! define clear responsibilities for each little helper func. keep them focused on one job at a time - that way error handling becomes much cleaner too ❌

what do you think? is there any specific go project or library out in the wild right now where these issues are handled exceptionally well, and we can all learn from it?

any tips to share for newbies trying not fall into this trap

link: https://dzone.com/articles/clean-code-functions-error-handling-go-part-1

ce945 No.1481

File: 1776086652120.jpg (70.88 KB, 1880x1255, img_1776086638296_s7rgn2mx.jpg)ImgOps Exif Google Yandex

>>1480
/write functions with clear names and comments to make error handling easier ⚡



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]
. "http://www.w3.org/TR/html4/strict.dtd">