این ریپو لیستی از پروژه های اوپن سورسه که ایرانی ها ساختنش
چیزای بدرد بخوری توش داره حتما نگاهی بهش بندازید.
https://github.com/mohebifar/made-in-iran
#DevTwitter | <Reza Omranian/>
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
چیزای بدرد بخوری توش داره حتما نگاهی بهش بندازید.
https://github.com/mohebifar/made-in-iran
#DevTwitter | <Reza Omranian/>
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
🍾5😁2🕊2💊1
🔷️How Databases Execute SQL Statements?
🌏1. A SQL statement starts in a client program and gets sent over the network to the database server.
🌏2. When the database server receives the SQL statement, the relational engine starts processing it. First the command parser checks that the statement is valid. Then it converts the statement into a query tree, which is an internal data structure.
🌏3. The query optimizer looks at the query tree and figures out the most efficient way to execute the SQL statement, creating an execution plan.
🌏4. The execution plan gets passed to the query executor, which uses it to coordinate retrieving or changing the data as directed by the SQL statement. The executor interacts with the storage engine to access the data.
🌏5. The storage engine uses access methods, which are protocols for reading and writing data in the most efficient way for different operations.
🌏6. For reading data, the buffer manager checks if the required data is cached in memory and fetches it from disk if needed. This speeds up subsequent access.
🌏7. For writing data with inserts or updates, the transaction manager makes sure the changes happen atomically and maintain the database's integrity.
🌏8. At the same time, the lock manager applies locks so multiple transactions can happen simultaneously without conflict. This maintains isolation and consistency.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
🌏1. A SQL statement starts in a client program and gets sent over the network to the database server.
🌏2. When the database server receives the SQL statement, the relational engine starts processing it. First the command parser checks that the statement is valid. Then it converts the statement into a query tree, which is an internal data structure.
🌏3. The query optimizer looks at the query tree and figures out the most efficient way to execute the SQL statement, creating an execution plan.
🌏4. The execution plan gets passed to the query executor, which uses it to coordinate retrieving or changing the data as directed by the SQL statement. The executor interacts with the storage engine to access the data.
🌏5. The storage engine uses access methods, which are protocols for reading and writing data in the most efficient way for different operations.
🌏6. For reading data, the buffer manager checks if the required data is cached in memory and fetches it from disk if needed. This speeds up subsequent access.
🌏7. For writing data with inserts or updates, the transaction manager makes sure the changes happen atomically and maintain the database's integrity.
🌏8. At the same time, the lock manager applies locks so multiple transactions can happen simultaneously without conflict. This maintains isolation and consistency.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍9
این کتاب رو پیشنهاد میکنم
سرفصل کتاب 👇
Table of Contents
Chapter 1. Software Efficiency Matters
Chapter 2. Efficient Introduction to Go
Chapter 3. Conquering Efficiency
Chapter 4. How Go Uses the CPU Resource (or Two)
Chapter 5. How Go Uses Memory Resource
Chapter 6. Efficiency Observability
Chapter 7. Data-Driven Efficiency Assessment
Chapter 8. Benchmarking
Chapter 9. Data-Driven Bottleneck Analysis
Chapter 10. Optimization Examples
Chapter 11. Optimization Patterns
لینک خرید
https://skybooks.ir/products/Efficient-Go
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
سرفصل کتاب 👇
Table of Contents
Chapter 1. Software Efficiency Matters
Chapter 2. Efficient Introduction to Go
Chapter 3. Conquering Efficiency
Chapter 4. How Go Uses the CPU Resource (or Two)
Chapter 5. How Go Uses Memory Resource
Chapter 6. Efficiency Observability
Chapter 7. Data-Driven Efficiency Assessment
Chapter 8. Benchmarking
Chapter 9. Data-Driven Bottleneck Analysis
Chapter 10. Optimization Examples
Chapter 11. Optimization Patterns
لینک خرید
https://skybooks.ir/products/Efficient-Go
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍4
Gopher Academy
این کتاب رو پیشنهاد میکنم سرفصل کتاب 👇 Table of Contents Chapter 1. Software Efficiency Matters Chapter 2. Efficient Introduction to Go Chapter 3. Conquering Efficiency Chapter 4. How Go Uses the CPU Resource (or Two) Chapter 5. How Go Uses Memory Resource…
♻️ The primary task of software engineers is the cost effective development of maintainable and useful software
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
jon Louis Bentley
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
🔥5
📥 دریافت شده از: Vesal Behrouzi
-------------
داشتم میگفتم وقتی میرید به شرکت جدید به جای حل کردن مشکلاتی که وجود ندارند، اولویت ندارن یا ازتون خواسته نشده و... یه 6 ماهی آروم بشینید و فقط نگاه کنید تا فضا و اتمسفر دستتون بیاد، اولویتها رو بهتر درک کنید، ساختار شرکت و مشکلات رو بهتر بشناسید، بعد یواش یواش میتونید شروع کنید به انجام کارهایی که فرای انتظاراتی هستند که بابتش استخدام شدید، خلاصه در همین راستا از اتاق فرمان شرح انتظارات شغل Staff Engineer شرکت داکر رو هم برای ما فرستادن که جهت استحضار به پیوست ضمیمه شود.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
-------------
داشتم میگفتم وقتی میرید به شرکت جدید به جای حل کردن مشکلاتی که وجود ندارند، اولویت ندارن یا ازتون خواسته نشده و... یه 6 ماهی آروم بشینید و فقط نگاه کنید تا فضا و اتمسفر دستتون بیاد، اولویتها رو بهتر درک کنید، ساختار شرکت و مشکلات رو بهتر بشناسید، بعد یواش یواش میتونید شروع کنید به انجام کارهایی که فرای انتظاراتی هستند که بابتش استخدام شدید، خلاصه در همین راستا از اتاق فرمان شرح انتظارات شغل Staff Engineer شرکت داکر رو هم برای ما فرستادن که جهت استحضار به پیوست ضمیمه شود.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍19🔥3🕊1
برنامه هایی که با گولنگ نوشته میشن یک از شایع ترین خطاهایی که در runtime و روی production باهاش مواجه میشن خطای panic از جنس nil pointer هست. که میتونه منجر به از کار افتادن برنامه هم بشه، هر چند راه هایی وجود داره که شما بتونید panic رو recover کنید، اما اصولا جواب بهتر اینه که سعی کنید قسمت هایی از کد که باعث ایجاد این دسته از panic ها میشن رو شناسایی کنید و مشکل رو از ریشه حل کنید.
شرکت Uber اخیر مقاله ای منتشر کرده که در این مورد توضیحات خوبی رو ارائه داده، دوست داشتید مطالعه کنید.
NilAway: Practical Nil Panic Detection for Go
یه پروژه open-source هم در همین رابطه منشتر کرده که من روی یکی از پروژه هام اجراش کردم و کلی statement پیدا کرد که این مشکل رو داره احتمالا.
خودش هشدار داده که پروژه در دست توسعه ست و ممکنه خطای false positive داشته باشید، ولی بد نیست به پروسه ci اضافه بشه یا حداقل لوکال چک کنید.
نصب و اجراشم ساده ست.
#gocasts
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
panic: runtime error: invalid memory address or nil pointer dereference
شرکت Uber اخیر مقاله ای منتشر کرده که در این مورد توضیحات خوبی رو ارائه داده، دوست داشتید مطالعه کنید.
NilAway: Practical Nil Panic Detection for Go
یه پروژه open-source هم در همین رابطه منشتر کرده که من روی یکی از پروژه هام اجراش کردم و کلی statement پیدا کرد که این مشکل رو داره احتمالا.
خودش هشدار داده که پروژه در دست توسعه ست و ممکنه خطای false positive داشته باشید، ولی بد نیست به پروسه ci اضافه بشه یا حداقل لوکال چک کنید.
نصب و اجراشم ساده ست.
go install go.uber.org/nilaway/cmd/nilaway@latest
nilaway ./...
#gocasts
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍16🍾1
با استفاده از این هلم چارت میتونید انواع سرویسها (از جمله دیتابیس، بک اند، فرانت و وب سرور) رو روی کوبرنتیز دیپلوی کنید بدون این که نیاز باشه برای هر کدوم چارت جدا بنویسید.
https://github.com/aahemm/helm-microservice
تو این مقالهی ویرگول هم بیشتر توضیح داده شده:
https://vrgl.ir/yav68
#DevTwitter | <Aliakbar Hemmati/>
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
https://github.com/aahemm/helm-microservice
تو این مقالهی ویرگول هم بیشتر توضیح داده شده:
https://vrgl.ir/yav68
#DevTwitter | <Aliakbar Hemmati/>
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍2🍾2
🔷️ git 2.43.0 is here!
😉https://github.blog/2023-11-20-highlights-from-git-2-43/
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
😉https://github.blog/2023-11-20-highlights-from-git-2-43/
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍2🍾2🔥1🕊1
Slice pre-allocation
#tips #tricks
Did you know that it’s possible to use a pre-allocated slice without specifying the length of the array (zero). This allows us to use append just like we would:
🕊 @gopher_academy | @GolangEngineers
#tips #tricks
Did you know that it’s possible to use a pre-allocated slice without specifying the length of the array (zero). This allows us to use append just like we would:
// instead of➖➖➖➖➖➖➖➖
a := make([]int, 10)
a[0] = 1
// use this
b := make([]int, 0, 10)
b = append(b, 1)
🕊 @gopher_academy | @GolangEngineers
🔥1🕊1🍾1💊1
Chaining technique
#tips #tricks
The technique of chaining can be applied to function (pointer) receivers. To illustrate this, let’s consider a Person struct with two functions, AddAge and Rename, that can be used to modify it.
🕊 @gopher_academy | @GolangEngineers
#tips #tricks
The technique of chaining can be applied to function (pointer) receivers. To illustrate this, let’s consider a Person struct with two functions, AddAge and Rename, that can be used to modify it.
type Person struct {If you’re looking to add age to a person and then rename them, the typical approach is as follows:
Name string
Age int
}
func (p *Person) AddAge() {
p.Age++
}
func (p *Person) Rename(name string) {
p.Name = name
}
func main() {Alternatively, we can modify the AddAge and Rename function receivers to return the modified object itself, even if they don’t typically return anything.
p := Person{Name: "Aiden", Age: 30}
p.AddAge()
p.Rename("Aiden 2")
}
func (p *Person) AddAge() *Person {By returning the modified object itself, we can easily chain multiple function receivers together without having to add unnecessary lines of code:
p.Age++
return p
}
func (p *Person) Rename(name string) *Person {
p.Name = name
return p
}
p = p.AddAge().Rename("Aiden 2")➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
👍8🔥2🍾2
♻️Golang Weekly
♻️#485 — NOVEMBER 21, 2023
♻️https://golangweekly.com/issues/485
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
♻️#485 — NOVEMBER 21, 2023
♻️https://golangweekly.com/issues/485
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
👍2🍾2
♻️Official code style, effective, best practices in Go
🌷The Go Style Guide and accompanying documents codify the current best approaches for writing readable and idiomatic Go. Adherence to the Style Guide is not intended to be absolute, and these documents will never be exhaustive. Our intention is to minimize the guesswork of writing readable Go so that newcomers to the language can avoid common mistakes. The Style Guide also serves to unify the style guidance given by anyone reviewing Go code at Google.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🌷The Go Style Guide and accompanying documents codify the current best approaches for writing readable and idiomatic Go. Adherence to the Style Guide is not intended to be absolute, and these documents will never be exhaustive. Our intention is to minimize the guesswork of writing readable Go so that newcomers to the language can avoid common mistakes. The Style Guide also serves to unify the style guidance given by anyone reviewing Go code at Google.
https://google.github.io/styleguide/go/index
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
👍3🕊2
♻️Optimized Code Is Not Readable♻️
🌷Undoubtedly, one of the most critical qualities of software code is its readability.
👇👇👇👇
👑 Book: Efficient Go
Data-Driven Performance Optimizations
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
🌷Undoubtedly, one of the most critical qualities of software code is its readability.
👇👇👇👇
It is more important to make the purpose of the code unmistakable than to display virtuosity.... The problem with obscure code is that debugging and
modification become much more difficult, and these are already the
hardest aspects of computer programming. Besides, there is the added
danger that a too clever program may not say what you thought it said.
👑 Book: Efficient Go
Data-Driven Performance Optimizations
➖➖➖➖➖➖➖➖
🕊 @gopher_academy | @GolangEngineers
❤4👍1💊1
Using import with ‘_’ for package initialization
#tips #tricks
Sometimes, in libraries, you may come across import statements that combine an underscore (_) like this:
Let’s consider an example to better understand how it works:
🕊 @gopher_academy | @GolangEngineers
#tips #tricks
Sometimes, in libraries, you may come across import statements that combine an underscore (_) like this:
import ( _ "google.golang.org/genproto/googleapis/api/annotations" )This will execute the initialization code (init function) of the package, without creating a name reference for it. This allows you to initialize packages, register connections, and perform other tasks before running the code.
Let’s consider an example to better understand how it works:
// underscore➖➖➖➖➖➖➖➖
package underscore
func init() {
fmt.Println("init called from underscore package")
}
// mainpackage main
import (
_ "lab/underscore"
)
func main() {}
// log: init called from underscore package
🕊 @gopher_academy | @GolangEngineers
👍5🍾2🔥1
Use import with dot .
#tips #tricks
Having explored how we can use import with underscore, let’s now look at how the dot . operator is more commonly used.
As a developer, the dot . operator can be used to make the exported identifiers of an imported package available without having to specify the package name, which can be a helpful shortcut for lazy developers.
Pretty cool, right? This is especially useful when dealing with long package names in our projects, such as
To demonstrate, here’s a brief example:
🕊 @gopher_academy | @GolangEngineers
#tips #tricks
Having explored how we can use import with underscore, let’s now look at how the dot . operator is more commonly used.
As a developer, the dot . operator can be used to make the exported identifiers of an imported package available without having to specify the package name, which can be a helpful shortcut for lazy developers.
Pretty cool, right? This is especially useful when dealing with long package names in our projects, such as
externalmodel
or doingsomethinglonglib
To demonstrate, here’s a brief example:
package main➖➖➖➖➖➖➖➖
import (
"fmt"
. "math"
)
func main() {
fmt.Println(Pi) // 3.141592653589793
fmt.Println(Sin(Pi / 2)) // 1
}
🕊 @gopher_academy | @GolangEngineers
👍8🍾2💊1