Answer the question
In order to leave comments, you need to log in
How to create a global module from a package with go.mod?
It is assumed that I create a folder in C:\Users\...\go\src\github.com\myname\slices
, for example, for convenient work with slices. I am writing a package package slices
, and now I want to use it globally in any code of my repository github.com\myname\...
. I know that you need to initialize it first and then register it in the folder with the code that imports it
go mod init
go mod edit -replace github.com\myname\slices=C:\Users\...\go\src\github.com\myname\slices
go mod tidy
github.com\myname\slices
globally and without pandemonium?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question