Gopher Academy
3.34K subscribers
918 photos
40 videos
279 files
2K links
🕸 Gopher Academy

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

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

ادمین:
@mrbardia72
Download Telegram
#tip

دوستان به مثال بالا توجه کنید یه نکته ای وجود دارد که گاها باعث ایجاد خطا های Logical خواهد شد.

در مثال فوق:

۱. ما slice با نام items داریم که داخلش ۲۰ تا آیتم دارد.
۲. حال یک متغیر داریم به نام totalItem که قرار است برای ظرفیت و گرفتن تعداد مشخصی از item های items میخواهیم استفاده کنیم.
۳. یک متغیر از نوع slice ایجاد کردیم با فرض اینکه میخواهیم ظرفیت این slice یک تعداد مشخص باشه و کامپایلر ظرفیت بیشتری در نظر نگیرد.
۴. حال داخل حلقه ما تک تک آیتم های items را به num1 گرفتیم append کردیم.
۵. در ادامه num1 را به همراه len ش چاپ کردیم.

اتفاقی که افتاد ۱۰ تا المنت اول صفر و item ها به ادامه المنت ها اضافه شد.

make(slice, length, capacity)

وقتی شما length را مقدار دهی میکنی عملا داری تعداد مشخصی از المنت ها را با مقدار پیش فرض میسازید.

حال اگر به المنت های slice المنتی اضافه کنید به ادامه اون المنت های قبلی اضافه خواهد شد و تعداد المنت بیشتر از اون چیزی که خواستید خواهد بود.

https://go.dev/play/p/bjlc8E1Q776



🕊 @gopher_academy
👍12👎1💊1
New

🔵Returns pointer

🔵initialises to zero value of the type

🔵used for all types

Make

🔵Returns an initialised value of type T

🔵Does not initialise to zero value of the type

🔵Used for only slices, maps and channels


🕊 @gopher_academy
👍6
Interface

Where to use

🔴Abstraction - allow you to define a contract between different parts of a program without specifying how that contract will be implemented.

🔴Polymorphism - allows different types to be used interchangeably, as long as they implement the same interface.

🔴Testability - By defining interfaces for dependencies, you can create mock implementations of those dependencies that can be used for testing

🔴Flexibility - makes it easier to add new types to your program and make changes without having to modify existing code.


🕊 @gopher_academy
👍2🔥2
interface
Use cases

Standard library:
Go’s standard library makes heavy use of interfaces. For example, the io package defines several interfaces for input and output, such as io.Readerio.Writer, and io.Closer. These interfaces allow different types of input and output streams to be used interchangeably, as long as they implement the required methods.

Web development:
In web development, interfaces are often used to define the behavior of HTTP handlers. For example, the http.Handler interface defines a single method ServeHTTP, which takes an http.ResponseWriter and an http.Request and returns nothing. Any type that implements this method can be used as an HTTP handler.


🕊 @gopher_academy
👍2🐳1
اگه دنبال پروژه های ماشین لرنینگ برای تمرین و یادگیری میگردید این ریپاژیتوری بیشتر از ۹۰۰ پروژه داره که حسابی کمکتن میکنه توی این زمینه!

https://github.com/ml-tooling/best-of-ml-python

#DevTwitter | <Mehdi Mashayekhi/>


🕊 @gopher_academy
👍6🔥21🕊1
یک میلیون Thread با گرفتن فقط 461 مگابایت مموری.
این قدرت هندل کردن Thread ها و GC سی شارپ میرسونه که چقدر روش کار شد و همونطورم که تو ویدیو میبینید چقدر به زبان Rust نزدیک شده (تازه با دات نت 6 هست).
youtu.be/WjKQQAFwrR4
https://github.com/ThePrimeagen/ts-rust-zig-deez

#DevTwitter | <Hootan HT/>

🕊 @gopher_academy
🤣14🔥2🗿2🕊1🐳1🍾1

🕊 @gopher_academy
🤣8👍31🐳1🗿1
How discord store trillions of messages

🕊 @gopher_academy
👍9🤔4
#job #golang

🕊 @gopher_academy
👍6🤔21
A list of APIs from Iran
لیست API های ارائه شده توسط سایت‌های ایرانی

#api #iran #farsi #persian #list #curated

https://github.com/Hameds/APIs-made-in-Iran


🕊 @gopher_academy
🍾2👍1🕊1
پروژه شبکه بلاکچین Pactus

پروژه‌ای که بیش از دو سال از شروعش میگذره. چندین بار در کلیت پروژه تغییرات داده شد تا به یک استحکام نسبی برسد. در حال حاضر شبکه آزمایشی پروژه درحال اجراست. این شبکه خیلی تا حالا به ما کمک کرده. چندین مشکل را تو شبکه آزمایشی تونستیم پیدا کنیم و رفع و رجوع‌شون کنیم.

مسیر پروژه خیلی همواره نبوده. هنوز خیلی کار و مشکل هست، اما در یک جمع‌بندی کلی، میشه گفت که پروژه به یک ثبات اولیه رسیده. در حال حاضر ۲۰۰ ولیدیتور در شبکه هستند و تخمین خودمون چیزی در حدود ۲۵ تا ۵۰ کامپیوتر هم در شبکه بهم متصل هستند. انتظار داریم بتونیم به ۱۰۰۰ ولیدیتور و ۲۰۰ کامپیوتر برسیم.

اما Maintainer و توسعه دهنده اصلی این پروژه آقای مصطفی صداقت جو (@mos_joo) می باشد که اهل مالزی است و ۲ سال است فوکوس کرده روی این پروژه.

اکنون این پروژه localnet, testnet دارد که داخل testnet حدودا ۲۰۰ ولیدتور فعال دارد که دارند staking می کنند برروی شبکه و اما شبکه mainnet در حال تکمیل شدن است و در Q3 امسال استارت می شود.

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

اگر علاقه مند به برنامه نویسی حوزه بلاکچین هستید پروژه پکتوس یک شروع خوب برای یادگیری برنامه نویس بلاکچین هست.

برنامه نویسی بلاکچین مثل کوه یخ می ماند:
- بخش روی سطح آب می توانیم به قراردادهای هوشمند و کارهای روتین با شبکه دانست.
- بخش زیر آب برنامه نویسی شبکه بلاکچین و node و کلیات خود شبکه است (بخش پردرآمد این روزا).

نکته آخر و خوب شما می توانید با مشارکت خود در توسعه این پروژه به پیشرفت پروژه و افزایش دانش خود کمک کنید و ما یکسری مزایا برای پیوستن به تیم توسعه دهنده در نظر گرفتیم:

۱. دریافت bounty برای انجام issue هایی که لیبل bounty دارند.
۲. ورکشاپ های رایگان آموزش کلیات برنامه نویسی بلاکچین (یادگیری عمیق عناوین)
۳. پیوستن به تیم core developer در صورت صلاح دید.
۴. تقویت رزومه شما در زمینه بلاکچین
۵. پرداخت ریالی bounty ها برای مشارکت کنندگان داخل کشور
و...

لینک ها

- صفحه خانگی: https://pactus.org/
- آموزش عناوین کلی پروژه: https://pactus.org/learn/
- نقشه راه: https://pactus.org/about/roadmap/
- اکسپلورر: https://pactusscan.com
- گیتهاب: https://github.com/pactus-project
- مخزن پروژه: https://github.com/pactus-project/pactus
- نحوه مشارکت: https://github.com/pactus-project/pactus/blob/main/CONTRIBUTING.md
- دیسکورد پکتوس: https://discord.gg/H5vZkNnXCu
- کانال تلگرام پکتوس: https://t.me/pactusblockchain


🕊 @gopher_academy
🔥72💊2👍1🕊1
🔵Initializing Large Static Maps in Go
🟢
https://www.dolthub.com/blog/2023-06-16-static-map-initialization-in-go/

🔵math/rand/v2 - a new API for math/rand and a first v2 for std
🟢
https://github.com/golang/go/discussions/60751

🔵A POSIX-compliant AWK interpreter written in Go, with CSV support
🟢
https://github.com/benhoyt/goawk

🔵Select, put and delete data from JSON, TOML, YAML, XML and CSV files
🟢
https://github.com/TomWright/dasel

🔴Golang Weekly
🔴Issue #465 — June 20, 2023

🕊
@gopher_academy
1👍1🕊1
Gopher Academy pinned « پروژه شبکه بلاکچین Pactus پروژه‌ای که بیش از دو سال از شروعش میگذره. چندین بار در کلیت پروژه تغییرات داده شد تا به یک استحکام نسبی برسد. در حال حاضر شبکه آزمایشی پروژه درحال اجراست. این شبکه خیلی تا حالا به ما کمک کرده. چندین مشکل را تو شبکه آزمایشی تونستیم…»
🔵Russ Cox

🟢 https://github.com/rsc
🔴 https://research.swtch.com/

🕊 @gopher_academy
🤔5👍3🔥1🕊1🤣1
🔵interfacebloat

🔻Interface bloat (anti-pattern, also called fat interface) is when an interface incorporates too many operations on some data.

🔻A linter that checks length of interface.

🔻The bigger the interface, the weaker the abstraction. (C) Go Proverbs

🟢Install
go install github.com/sashamelentyev/interfacebloat

🟢Examples
interfacebloat ./...

🔴https://github.com/sashamelentyev/interfacebloat


🕊 @gopher_academy
👍2🍾1
🎉 Go 1.21 Release Candidate 2 is released!

🏖 Run it in dev! Run it in prod! File bugs! https://go.dev/issue/new

📣 Announcement: https://groups.google.com/g/golang-announce/c/REcCdQj1taA

⬇️ Download: https://go.dev/dl/#go1.21rc2


🕊 @gopher_academy
🗿4👍1
William_Denniss_Kubernetes_for_Developers_MEAP_v14_Manning_Publications.pdf
10.2 MB
Kubernetes for Developers (MEAP v14)

Author(s): William Denniss
Publisher: Manning Publications, Year: 2023

Description:
Kubernetes for Developers is a hands-on guide to taking your first steps into Kubernetes using the powerful Google Kubernetes Engine service.

Kubernetes for Developers is a clear and practical beginner’s guide that shows you just how easy, flexible, and cost-effective it can be to make the switch to Kubernetes deployment even for small to medium-sized applications.

Kubernetes for Developers is a hands-on guide to taking your first steps into Kubernetes using the powerful Google Kubernetes Engine service. It lays out a map for taking an application, containerizing it, and then deploying it onto Kubernetes.


🕊 @gopher_academy
🤔2🍌2🗿1
🔵Unexpected downsides of UUID keys in PostgreSQL - CYBERTEC

🔴https://www.cybertec-postgresql.com/en/unexpected-downsides-of-uuid-keys-in-postgresql/


🕊 @gopher_academy
👍1🐳1🍾1

🕊 @gopher_academy
🤣13
🎁 (AirDrop) 80 PAC-coin received in mainnet for join in testnet validators now

We are thrilled to announce the airdrop 🪂 program of (https://pactus.org/). Here's how to participate:

Step 1:
Join Pactus Discord server (https://discord.gg/H5vZkNnXCu).

Step 2:
Follow Pactus Twitter account (https://twitter.com/PactusChain), like and retweet the latest announcement.
Then, fill out the form below with your Twitter account ID to receive 10 PAC-coin on the Mainnet launch.
This helps us spread the word about Pactus and our upcoming launch.

Step 3:
Follow Pactus Instagram page (https://www.instagram.com/pactus.blockchain/), like and comment on the latest post.
Then, fill out the form below with your Instagram account ID to receive 10 PAC-coin on the Mainnet launch.
This helps us spread the word about Pactus and our upcoming launch.

Step 4:
Join the Testnet as a validator to receive 80 PAC-coin on the Mainnet launch :

Download (https://pactus.org/download) the latest version of Pactus Blockchain.
Install and run your node and join the Testnet-1.
Find your Validator address and fill it in the form below
Keep your node running until Mainnet launch to receive 80 PAC-coin on Mainnet launch.
Additionally, you can convert every 1000 Testnet PAC to 1 PAC on the Mainnet launch.

The airdrop will continue until 500 validators have been registered.

By joining the Testnet, you help us test the blockchain in a testing environment and prepare for the Mainnet launch.
Thank you for your support of Pactus. Together we can build a future for blockchain technology and decentralized networks.

Pactus Airdrop Form:
https://docs.google.com/forms/d/e/1FAIpQLSfJ-uiNQtGZdqdApwOCU9oF_O2qAVVa2P2EJtLJvKHxvjQhpQ/viewform


🕊 @gopher_academy
👎6🤔31🔥1🕊1🤣1
Media is too big
VIEW IN TELEGRAM
آموزش درخت Merkle

در این آموزش مهندس مصطفی صداقت جو به بحث آشنایی با درخت Merkle میپردازد و این درخت پرکاربرد در حوزه بلاکچین و حوزه های دیگر در حال استفاده است.

و از همه مهمتر می توانید فرق درخت Merkle در بیت کوین و اتریوم و هچنین پکتوس آشنا شوید.

🔗 لینک ویدئو در یوتیوب: https://www.youtube.com/watch?v=tXlRkAYmJcI

🔗 شنیدن پادکست در اسپاتیفای: https://open.spotify.com/show/6aQdgKiOF5tuzI7mpijlfj

🔗 شنیدن پادکست در گوگل پادکست: https://podcasts.google.com/feed/aHR0cHM6Ly9hbmNob3IuZm0vcy9kZGY3OWRiNC9wb2RjYXN0L3Jzcw

🔗 شنیدن پادکست در کست باکس: https://castbox.fm/va/5381928

🔗 آدرس پروژه: https://pactus.org



🕊 @gopher_academy
👍10👎1🕊1