📥 دریافت شده از: Sahn Lam
-------------
♻️API vs SDK: Key Differences
APIs (Application Programming Interfaces) and SDKs (Software Development Kits) are essential tools for software development, but they serve different purposes:
API:
An API is a set of rules and protocols that allows different software applications and services to communicate and share data.
1. Defines a standard interface for components to interact.
2. Allows integration between software written in different languages and frameworks.
3. Typically provides endpoints for requesting and serving data..
SDK:
An SDK is a comprehensive package of tools, libraries, sample code, and documentation to simplify building apps on a specific platform, framework, or hardware.
1. Provides higher-level abstractions to ease development for a target platform.
2. Designed to integrate seamlessly with the underlying platform, ensuring compatibility and optimal performance.
3. Grants access to platform-specific capabilities and features that may be complex to implement from scratch.
The choice between APIs and SDKs depends on the project's goals and technical needs. APIs offer platform-agnostic interoperability, while SDKs provide convenient access to proprietary platform functionality.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
-------------
♻️API vs SDK: Key Differences
APIs (Application Programming Interfaces) and SDKs (Software Development Kits) are essential tools for software development, but they serve different purposes:
API:
An API is a set of rules and protocols that allows different software applications and services to communicate and share data.
1. Defines a standard interface for components to interact.
2. Allows integration between software written in different languages and frameworks.
3. Typically provides endpoints for requesting and serving data..
SDK:
An SDK is a comprehensive package of tools, libraries, sample code, and documentation to simplify building apps on a specific platform, framework, or hardware.
1. Provides higher-level abstractions to ease development for a target platform.
2. Designed to integrate seamlessly with the underlying platform, ensuring compatibility and optimal performance.
3. Grants access to platform-specific capabilities and features that may be complex to implement from scratch.
The choice between APIs and SDKs depends on the project's goals and technical needs. APIs offer platform-agnostic interoperability, while SDKs provide convenient access to proprietary platform functionality.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍4
🍾4👍1
🟢7 Tips To Write Clean And Better Code in 2023
https://www.geeksforgeeks.org/7-tips-to-write-clean-and-better-code-in-2020/
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
https://www.geeksforgeeks.org/7-tips-to-write-clean-and-better-code-in-2020/
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
🔥2
✅ Pitfalls: avoid unintentional recursion or other issues that could lead to stack overflow json marshal or unmarshal
code:
output:
MarshalJSON person 2 this creates a recursive loop, causing the stack to grow until it exceeds the limit, resulting in a stack overflow error.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
code:
package main
import (
"encoding/json"
"fmt"
"log"
)
type Person struct {
Name string `json:"name"`
Age int `json:"age"`
}
type Person2 struct {
Name string `json:"name"`
Age int `json:"age"`
}
func (p *Person) MarshalJSON() ([]byte, error) {
var person Person
person = *p
return json.Marshal(person)
}
func (p *Person2) MarshalJSON() ([]byte, error) {
return json.Marshal(p)
}
func main() {
person := new(Person)
person.Name = "Javad"
person.Age = 29
b, err := person.MarshalJSON()
if err != nil {
log.Fatal(err)
}
fmt.Println(string(b))
person2 := new(Person2)
person2.Name = "Javad"
person2.Age = 29
b, err = person2.MarshalJSON()
if err != nil {
log.Fatal(err)
}
fmt.Println(string(b))
}
output:
{"name":"Javad","age":29}
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc020160390 stack=[0xc020160000, 0xc040160000]
fatal error: stack overflow
MarshalJSON person 2 this creates a recursive loop, causing the stack to grow until it exceeds the limit, resulting in a stack overflow error.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍4💊3
Gopher Academy
✅ Pitfalls: avoid unintentional recursion or other issues that could lead to stack overflow json marshal or unmarshal code: package main import ( "encoding/json" "fmt" "log" ) type Person struct { Name string `json:"name"` Age int `json:"age"`…
What is the maximum stack size for Goroutine?
While the minimum stack size is defined as 2048 bytes, the Go runtime does also not allow goroutines to exceed a maximum stack size; this maximum depends on the architecture and is 1 GB for 64-bit and 250MB for 32-bit systems.
جزئیات مقاله👇♻️
🔷️ https://tpaschalis.me/goroutines-size/
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
While the minimum stack size is defined as 2048 bytes, the Go runtime does also not allow goroutines to exceed a maximum stack size; this maximum depends on the architecture and is 1 GB for 64-bit and 250MB for 32-bit systems.
جزئیات مقاله👇♻️
🔷️ https://tpaschalis.me/goroutines-size/
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍6🍾1
🔵 فلسفه یونیکس میگه:
🟢 «برنامههایی بنویسید که یک کار کوچیک رو به خوبی انجام بدن و باهمدیگه ترکیب بشن.»
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
🟢 «برنامههایی بنویسید که یک کار کوچیک رو به خوبی انجام بدن و باهمدیگه ترکیب بشن.»
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍20🔥4❤2🍾2🕊1
یه برنامه خیلی سبک برای اینکه لاگهای کانتینرهاتون رو بصورت interactive توی browser ببینید ( به جای اینکه توی ترمینال docker log بزنید)
#pythony
https://dozzle.dev
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
#pythony
https://dozzle.dev
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍6🔥2
✅ Go 1.21.4 and 1.20.11 are released!
🗣 Announcement: https://groups.google.com/g/golang-announce/c/4tU8LZfBFkY
🗃 Download: go.dev/dl/#go1.21.4
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
🔐 Security: Includes security fixes for path/filepath (CVE-2023-45283, CVE-2023-45284)
🗣 Announcement: https://groups.google.com/g/golang-announce/c/4tU8LZfBFkY
🗃 Download: go.dev/dl/#go1.21.4
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
💊4
✅ مشارکت و انجام issue به همراه bounty
در زیر تسکی داریم خیلی مهم هستش و همچنین برای شروع مشارکت در پروژه آزاد مناسب می باشد.
https://github.com/pactus-project/pactus/issues/805
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
در زیر تسکی داریم خیلی مهم هستش و همچنین برای شروع مشارکت در پروژه آزاد مناسب می باشد.
https://github.com/pactus-project/pactus/issues/805
توضیحات درخصوص تسک:
ما از کاربران گزارشهای زیادی دریافت کردهایم که نمیتوانند نود خود را اجرا کنند به دلیل خطای 'منبع به طور موقت در دسترس نیست'. این مشکل زمانی پیش میآید که در حال حاضر یک نود در پسزمینه در حال اجرا است و کاربران تلاش میکنند تا یک نود جدید را شروع کنند. ما باید یک راه برای شناسایی اینکه یک نمونه از Pactus در حال اجرا است را پیدا کنیم. اگر چنین است، باید کاربر را قبل از تلاش برای شروع یک نود جدید مطلع کنیم تا از این خطا جلوگیری شود.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
💊4🔥3👍1
1699469074421.pdf
1 MB
👍6❤1🕊1
✅ آموزش استفاده از go.work و ورژن بندی هر ماژول
در زیر آموزش استفاده از go workspace را قرار دادیم که بتوانید چندین ماژول با ورژن اختصاصی تعریف و داخل pkg.go.dev چطور ثبت کنید.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
در زیر آموزش استفاده از go workspace را قرار دادیم که بتوانید چندین ماژول با ورژن اختصاصی تعریف و داخل pkg.go.dev چطور ثبت کنید.
مخزن: https://github.com/Ja7ad/go-work
پکیج: https://pkg.go.dev/pkg.go.dev/github.com/Ja7ad/go-work
ماژول ۱: https://pkg.go.dev/github.com/Ja7ad/go-work/mod1
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍5
اگر پرمیوم هستید در تلگرام می توانید با زدن Boost از کانال گوفر آکادمی و گروه مهندسین گولنگ حمایت کنید.
https://t.me/gopher_academy?boost
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
https://t.me/gopher_academy?boost
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
🍾4
#fact
In Go (Golang), the boolean values true and false are untyped bool. This means that unlike many other programming languages, where boolean values have a specific type (e.g., bool), in Go, true and false are untyped. This design choice allows for greater flexibility in certain expressions and comparisons. The constants true and false are defined as untyped bool constants, and they can be used in various contexts without requiring explicit casting to a boolean type. This is a distinctive feature of Go's type system.
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
In Go (Golang), the boolean values true and false are untyped bool. This means that unlike many other programming languages, where boolean values have a specific type (e.g., bool), in Go, true and false are untyped. This design choice allows for greater flexibility in certain expressions and comparisons. The constants true and false are defined as untyped bool constants, and they can be used in various contexts without requiring explicit casting to a boolean type. This is a distinctive feature of Go's type system.
// true and false are the two untyped boolean values.
const (
true = 0 == 0 // Untyped bool.
false = 0 != 0 // Untyped bool.
)
➖➖➖➖➖➖➖➖
🕊 @gopher_academy
👍3💊2🕊1