🐫Go

Go is a compiled programming language that makes some sense. Mycorrhiza is written in Go.

Go creates static binaries by default unless you use cgo to call C code, in which case it will create a dynamically linked binary. Using cgo is more common than many people assume as the os/user and net packages use cgo, so importing either (directly or indirectly) will result in a dynamic binary.

And do I need to explain how bad it looks to have GitHub support baked right into your toolchain in 2020? We tried to warn you, folks.

SQLite is a wonderful piece of software and it is completely meaningful to use it in a project written in Go even though SQLite itself is in C. Though people has been hitting lots of issues with it, mostly "database is locked" error that seems to appear out of nowhere.

First of all, SQLite allows concurrent readers but only a single writer. Unlike most places where you may encounter some sort of synchronization SQLite does not wait for the write lock to become available - instead it just returns an error, letting the caller deal with it. This is why you are getting "database is locked" errors.

Примеры графиков, рисуемых гонумом.

Ebiten (/ebíteɴ/) is an open source game library for the Go programming language. Ebiten's simple API allows you to quickly and easily develop 2D games that can be deployed across multiple platforms.

Gophernotes is a Go kernel for Jupyter notebooks and nteract. It lets you use Go interactively in a browser-based notebook or desktop app. Use gophernotes to create and share documents that contain live Go code, equations, visualizations and explanatory text. These notebooks, with the live Go code, can then be shared with others via email, Dropbox, GitHub and the Jupyter Notebook Viewer. Go forth and do data science, or anything else interesting, with Go notebooks!

Perhaps the matter I most appreciate Go for is its long-term commitment to simplicity, stability, and robustness. I prize these traits more strongly than any other object of software design. The Go team works with an ethos of careful restraint, with each feature given deliberate consideration towards identifying the simplest and most complete solution, and they carefully constrain the scope of their implementations to closely fit those solutions. The areas where Go has failed in this regard are frightfully scarce.

Любопытный, но довольно бесполезный пример полиморфизма в Go

В гошечке есть несколько способов писать полиморфные функции:

  1. интерфейсы;

  2. тайп свитчи и тайп кастинг интерфейсов;

  3. рефлексия;

Недавно мне понял, что есть чётвёртый подход, который стал возможен с появлением type alias — назовём его апкастингом типов. Работает оно так:

func main() {
printName(Cat{"Whiskey"})
printName(Dog{"Chappie"})
}

type Cat struct { Name string }

type Dog struct { Name string }

type named = struct { Name string }

func printName(n named) {
fmt.Println(n.Name)
}

В спеке Go указано, что присваивание x типа V к переменной типа T валидно в случае, если V и T основаны на одинаковых типах и T — не именованный тип ("x's type V and T have identical underlying types and at least one of V or T is not a defined type."). Псевдонимы типов не считются именованными типами, так что мы можем принимать в аргумент n любую кастуемую структуру.

К сожалению, это не слишком полезно — наверное только если вы не хотите делать пачку геттеров и у вас есть пачка одинаковых структур разных типов.

Очень велик соблазн узнать, как писать идиоматичный, каноничный код на Go (да и вообще в целом).

Потом ссылается на статью ниже:

The author applies the Zen of Python to Go and tells us how Go programs should be written. This is a well-written article.

For some reason.

The author applies the belts from martial arts to Go knowledge. I have the green one.

Bookmark

A wonderful read

I get the impression that a map can only hold 64 values from this text, but this is not true. How does it work?

В данном канале перечислены все преимущества языка программирования Go.

Go is not an easy programming language. It is simple in many ways: the syntax is simple, most of the semantics are simple. But a language is more than just syntax; it’s about doing useful stuff. And doing useful stuff is not always easy in Go.

XahLee сказал:

the best languages to learn today for the next 20 year are: golang, PowerShell, Mathematica.

Про голянг понятно. Про остальное:

PowerShell or the pwsh, is far better shell than bash and unix bag friends.
Mathematica, is the programing language far beyond any other in the computing industry. A magnitude beyond all existing. It is more than a programing language, because it is really a computational knowledge base. Asides from math functions, such as solving equations or integration symbolically and hundreds other special math functions only a handful mathematician understands, it also embodies just about every practical algorithm in computer science. So, given a algorithm, you might write it in lang X for a hour or days, but Mathematica has it as part of the language, just call a function. Mathematica has few thousand functions builtin, not even needing to load a library.

🍄: Мне нравится, когда люди хорошо говорят о Мафематике. Мне она тоже нравится. Хочу как-нибудь лицензию получить... Говорят, с малиной π в комплекте идёт 🤔