TOP 5 of the most stupid questions about Golang for Interviews of Senior Engineers

  1. Slices vs Arrays – – I think some newbies in interviews think that it will show how deep the candidate understands internals of Golang type system. WAT? – Pls, don’t ask such questions just ask about cases.
  2. What is the String type in Golang? Is it mutable ? – no comments, I don’t even know what is the purpose of this question. LOL
  3. Why Golang needs Slices? – same as #2
  4. What programming language will you choose for development?
  5. Golang vs Node JS and why you prefer Golang instead of JS ?

App build fail fix for session_srtp.go:144:9: assignment mismatch: 1 variable but h.Unmarshal returns 2 values

# github.com/pion/srtp/v2
../../../../1.16.2/pkg/mod/github.com/pion/srtp/v2@v2.0.2/session_srtp.go:144:9: assignment mismatch: 1 variable but h.Unmarshal returns 2 values
../../../../1.16.2/pkg/mod/github.com/pion/srtp/v2@v2.0.2/srtp.go:37:9: assignment mismatch: 1 variable but header.Unmarshal returns 2 values
../../../../1.16.2/pkg/mod/github.com/pion/srtp/v2@v2.0.2/srtp.go:52:9: assignment mismatch: 1 variable but header.Unmarshal returns 2 values
../../../../1.16.2/pkg/mod/github.com/pion/srtp/v2@v2.0.2/srtp.go:56:51: header.PayloadOffset undefined (type *rtp.Header has no field or method PayloadOffset)
../../../../1.16.2/pkg/mod/github.com/pion/srtp/v2@v2.0.2/srtp_cipher_aead_aes_gcm.go:99:13: header.PayloadOffset undefined (type *rtp.Header has no field or method PayloadOffset)
../../../../1.16.2/pkg/mod/github.com/pion/srtp/v2@v2.0.2/srtp_cipher_aead_aes_gcm.go:104:18: header.PayloadOffset undefined (type *rtp.Header has no field or method PayloadOffset)
../../../../1.16.2/pkg/mod/github.com/pion/srtp/v2@v2.0.2/srtp_cipher_aes_cm_hmac_sha1.go:121:30: header.PayloadOffset undefined (type *rtp.Header has no field or method PayloadOffset)
../../../../1.16.2/pkg/mod/github.com/pion/srtp/v2@v2.0.2/srtp_cipher_aes_cm_hmac_sha1.go:126:32: header.PayloadOffset undefined (type *rtp.Header has no field or method PayloadOffset)
../../../../1.16.2/pkg/mod/github.com/pion/srtp/v2@v2.0.2/stream_srtp.go:88:6: assignment mismatch: 1 variable but header.Unmarshal returns 2 values

While working on the one of my pet projects I caught the issue with building of my app. The fix is very easy but I spent some time to find out the issue and how to solve it.

So if you have the same issue you have to add to your go.mod file such line:

github.com/pion/srtp/v2 v2.0.5 // indirect

And update your packages with go mod. The problem was on this line – https://github.com/pion/srtp/compare/v2.0.4…v2.0.5#diff-42e63a61fe336233215c8623a90b1e1697a38e30aa9cafc1c396a9e37d61c00cR144

Golang library for MongoDB (DBAL)

Here is my DBAL implementation for mongoDB that I am using in my daily routines.

It contains features that I am using frequently it does not contain any implementation for DSL or Query Builders.

All extra features will be added later or maybe I will put it into a different library.

https://github.com/wajox/mongol

CloneGoPkg – CLI tool to create new package from template in git repository

CloneGoPkg is a simple CLI tool to create your own package from template based on any git repository

Install

go install -i github.com/wajox/clonegopkg

Usage

# clonegopkg clone [git_repository_template] [new_pkg]
clonegopkg clone git@github.com:wajox/gobase.git github.com/wajox/newproject

Sources

GitHub – https://github.com/wajox/clonegopkg

Watermill Pub-Sub(broadcasting) example for AMQP(rabbit)

What is Watermill?

“Watermill is a Golang library for working efficiently with message streams. It is intended for building event-driven applications. It can be used for event sourcing, RPC over messages, sagas, and whatever else comes to your mind. You can use conventional pub/sub implementations like Kafka or RabbitMQ, but also HTTP or MySQL binlog, if that fits your use case. It comes with a set of Pub/Sub implementations and can be easily extended by your own. Watermill also ships with standard middlewares like instrumentation, poison queue, throttling, correlation, and other tools used by every message-driven application.”

Why use Watermill?

“With more projects adopting the microservices pattern over recent years, we realized that synchronous communication is not always the right choice. Asynchronous methods started to grow as a new standard way to communicate. But while there’s a lot of existing tooling for synchronous integration patterns (e.g. HTTP), correctly setting up a message-oriented project can be a challenge. There’s a lot of different message queues and streaming systems, each with different features and client library API. Watermill aims to be the standard messaging library for Go, hiding all that complexity behind an API that is easy to understand. It provides all you might need for building an application based on events or other asynchronous patterns. After looking at the examples, you should be able to quickly integrate Watermill with your project.”


Golang Application Template

Here is my template for Golang Application – https://github.com/ildarusmanov/gobase https://github.com/wajox/gobase

Only one thing that you have to do after git clone – replace all package name entries, from github.com/ildarusmanov/gobase github.com/wajox/gobase to [your_package_name]

UPD:

Template has been updated and moved into wajox/gobase repository.