Gopher Academy
3.34K subscribers
920 photos
40 videos
280 files
2.02K links
🕸 Gopher Academy

🔷interview golang
https://github.com/mrbardia72/Go-Interview-Questions-And-Answers

حمایت مالی:
https://www.coffeete.ir/mrbardia72

ادمین:
@mrbardia72
Download Telegram
9 types api testing

🕊 @gopher_academy
👍12💊1
Do or Don't Pointers

Absolutely, pointers are quite important in Go. Here are some dos and don'ts for using them:

Do's:

1. Use pointers to modify a variable directly: This is, after all, the most common reason to use pointers in Go. For example, you're passing an argument to a function and want the function to modify the value of the argument.

2. Use pointers to save memory: Pointers are useful when you have large amounts of data that you don't want to copy. Instead, you can just pass around a pointer to that data.

3. Use nil checks: Before you interact with a pointer, you should first check if it is nil to avoid panics due to runtime errors.

4. Recognize pointer receiver and value receiver functions: The choice between pointer receiver and value receiver impacts how the method changes values.

Don'ts:

1. Don't forget to initialize a pointer before using it: Using a pointer that has not been initialized (a nil pointer) can lead to runtime panics. Always make sure to initialize your pointers with new, or make sure they point to actual data.

2. Don't use pointers where it's not needed: Pointers can make your code harder to understand and reason about. If you don't need to modify the data you're pointing to, it might be better to just pass by value.

3. Avoid unnecessary dereferencing: Do not dereference a pointer if you don't actually need the value it points to. Unnecessary dereferencing can slow down your program and make your code harder to understand.

4. Don't randomly mutate shared data: This can cause data races in a concurrent context. If multiple goroutines have a pointer to the same data, be sure to coordinate reads and writes to avoid unpredicted result.

Pointers can be very powerful in Go, but with that power comes the responsibility to use them wisely and carefully. Incorrect use can lead to unexpected behavior and difficult-to-track bugs.


🕊 @gopher_academy
👍31🕊1🍾1
‍ تلگرام اپدیت جدیدش یعنی 10.2 رو عرضه کرده که دارای قابلیتهای کاربردی مختلفی هست.

اولین قابلیت امکان ریپلای کردن و ارجاع به بخش خاصی از پیام یا پستهای کانال هست که به خصوص برای مطالب طولانی و چند بخشی میتونه کاربردی باشه. برای اینکه فقط کافیه متن موردنظرتون از پست رو انتخاب کنید و گزینه Quote رو فشار بدید.

همچنین میشه بخشی از متنی که مینویسین رو هم به حالت Quote دربیارین تا از بقیه متن متمایز بشه و مثلا برای کاربردی هایی مثل نقل قول کردن از اون استفاده کنید.

🕊 @gopher_academy
👍6
کتابخانه Irys

پلی برای ارتباط و آپلود فایل برروی بستر غیرمتمرکز (بلاکچین) Arweave با استفاده از توکن های ethereum و...

اگر برنامه نویس پروژه های DApp هستید و قصد دارید یک بستر غیرمتمرکز برای فایل داشته باشید می توانید از این پروژه استفاده کنید که شما فقط یک بار هزینه نگه داری دائم فایل برروی بستر غیرمتمرکز داشته باشید.

صفحه رسمی: https://irys.xyz/
مخزن کتابخانه گو: https://github.com/Ja7ad/irys
داکیومنت: https://pkg.go.dev/github.com/Ja7ad

درضمن تسک هایی داریم که میتوانید به عنوان پروژه آزاد مشارکت داشته باشید: https://github.com/Ja7ad/irys#todo


🕊 @gopher_academy
👍63🔥2💊1
12 tips for api security

🕊 @gopher_academy
👍4🕊1

🕊 @gopher_academy
😁20👍1🕊1
This media is not supported in your browser
VIEW IN TELEGRAM
فقط یه نفر تو دنیا هست که می‌تونه با پیژامه بشینه جلوی دوربین تا خلاصه کتاب زندگی‌نامه ایلان ماسک رو بگه و وسطش اسم ماسک رو هم یادش بره و باز همون رو ادامه بده.
عاشقتم مرد 😂❤️

🕊 @gopher_academy
28😁3🕊3💊2👍1
وقتی شرکت ها خودشون رو لو میدن

🕊 @gopher_academy
👍18🔥2
This media is not supported in your browser
VIEW IN TELEGRAM
Junior Dev 😂 senior devops

🕊 @gopher_academy
😁9
How to improve your leadership and management skills
👇👇👇👇👇

🕊 @gopher_academy
👍4
1698836734988.pdf
519.9 KB
How to improve your leadership and management skills


🕊 @gopher_academy
👍4
PM vs PO vs PJM

🕊 @gopher_academy
👍5🔥21🍾1
Forwarded from Pactus Announcements
🚨 Exciting Announcement, Pactus Community! 🎉

We are thrilled to announce that we are extending our Testnet-2 campaign and onboarding 500 more validators. That's right, 500 additional spots are now open for enthusiasts to join our growing network!

This is an incredible opportunity to be part of building the future of blockchain. As a Pactus validator, you'll contribute meaningfully to decentralizing the network and securing transactions.

As thanks for your participation, you will receive PAC coins as your rewards when Mainnet launches! Here is how the rewards work:
+ Based on the total number of staking coins you have, up to 100PAC
+ Your rewards will be equal to [Your Total Stakes] / 10
+ Please note that only stakes from the first validator will be counted.

To join as a Pactus validator, simply follow these steps:
+ Download latest release: https://pactus.org/download/
+ Get your initial staking in ⁠testnet-faucet channel in discord: https://discord.gg/pactus-795592769300987944
🕊2💊2
سلام دوستان
موقعیت شغلی بکند و گولنگ

نام شرکت: اوزون (زیر مجموعه گروه صنعتی گلرنگ)
نوع حضور : هیبرید
موقعیت شرکت: خیابان وزرا
عنوان شغلی: میدلول یا سنیور گولنگ
حداقل سابقه کار: ۲ سال

خیلی بهتر هست اگر
تجربه کار با rabbitMQ یا kafka
تجربه کار با elasticsearch
تجربه کار با redis
را داشته باشند


https://www.linkedin.com/posts/ozonesocial_cv-developer-aepaewaeaaewaeu-activity-7119217862568722433-LpCK?utm_source=share&utm_medium=member_desktop


🕊 @gopher_academy
👍5🍾4
Api vs SDK
👇🏻👇🏻👇🏻👇🏻

🕊 @gopher_academy
👍4🔥1
📥 دریافت شده از: 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
👍4
#day_tips

Store *big.Int as string into database.



🕊 @gopher_academy
🍾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
🔥2
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"`
}

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
👍6🍾1