Telegram Group & Telegram Channel
🔧 Локальное исправление зависимостей в Go

Иногда при разработке на Go возникает необходимость временно изменить внешний модуль — например, внести исправление, которое ещё не вмержили в основной репозиторий. Go предоставляет удобный механизм для этого.

🧩 Используем replace в go.mod

В Go можно использовать директиву replace, чтобы указать локальный путь вместо внешней зависимости:


replace github.com/some/module => ../local-copy/module


Теперь при сборке Go будет использовать код из ../local-copy/module вместо кода, загружаемого из Git.

Это особенно удобно, если вы:

* работаете над фиксом бага во внешнем пакете;
* тестируете pull request;
* занимаетесь временным форком библиотеки.

⚠️ Что важно помнить

1. Не коммитьте replace в main ветку!
Эти изменения локальны и не должны попадать в боевой код.

2. go get не влияет на replace
Даже если вы обновите модуль через go get, replace всё равно будет использовать локальный путь.

3. Проверьте go.sum
После замены зависимостей могут измениться хэши в go.sum. Это нормально, но стоит за этим следить.

🛠 Пример сценария

Вы нашли баг в github.com/example/lib, клонировали его:


git clone https://github.com/example/lib ~/dev/lib-patched


Затем в go.mod вашего проекта:


replace github.com/example/lib => ~/dev/lib-patched


Теперь go build будет использовать вашу локальную версию.

https://eli.thegreenplace.net/2024/locally-patching-dependencies-in-go/

👉 @golang_lib



tg-me.com/golang_lib/476
Create:
Last Update:

🔧 Локальное исправление зависимостей в Go

Иногда при разработке на Go возникает необходимость временно изменить внешний модуль — например, внести исправление, которое ещё не вмержили в основной репозиторий. Go предоставляет удобный механизм для этого.

🧩 Используем replace в go.mod

В Go можно использовать директиву replace, чтобы указать локальный путь вместо внешней зависимости:


replace github.com/some/module => ../local-copy/module


Теперь при сборке Go будет использовать код из ../local-copy/module вместо кода, загружаемого из Git.

Это особенно удобно, если вы:

* работаете над фиксом бага во внешнем пакете;
* тестируете pull request;
* занимаетесь временным форком библиотеки.

⚠️ Что важно помнить

1. Не коммитьте replace в main ветку!
Эти изменения локальны и не должны попадать в боевой код.

2. go get не влияет на replace
Даже если вы обновите модуль через go get, replace всё равно будет использовать локальный путь.

3. Проверьте go.sum
После замены зависимостей могут измениться хэши в go.sum. Это нормально, но стоит за этим следить.

🛠 Пример сценария

Вы нашли баг в github.com/example/lib, клонировали его:


git clone https://github.com/example/lib ~/dev/lib-patched


Затем в go.mod вашего проекта:


replace github.com/example/lib => ~/dev/lib-patched


Теперь go build будет использовать вашу локальную версию.

https://eli.thegreenplace.net/2024/locally-patching-dependencies-in-go/

👉 @golang_lib

BY Библиотека Go (Golang) разработчика


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/golang_lib/476

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

Telegram and Signal Havens for Right-Wing Extremists

Since the violent storming of Capitol Hill and subsequent ban of former U.S. President Donald Trump from Facebook and Twitter, the removal of Parler from Amazon’s servers, and the de-platforming of incendiary right-wing content, messaging services Telegram and Signal have seen a deluge of new users. In January alone, Telegram reported 90 million new accounts. Its founder, Pavel Durov, described this as “the largest digital migration in human history.” Signal reportedly doubled its user base to 40 million people and became the most downloaded app in 70 countries. The two services rely on encryption to protect the privacy of user communication, which has made them popular with protesters seeking to conceal their identities against repressive governments in places like Belarus, Hong Kong, and Iran. But the same encryption technology has also made them a favored communication tool for criminals and terrorist groups, including al Qaeda and the Islamic State.

Telegram hopes to raise $1bn with a convertible bond private placement

The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.

telegram from br


Telegram Библиотека Go (Golang) разработчика
FROM USA