-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Difference between github and local git repository #28214
Comments
In order to fetch modules, You might be able to set up a custom import domain like The other alternative is to use GOPROXY. See |
@mvasi90 Regarding your comment:
Regardless of what else you might be doing, I think you will run into trouble if you do not use a domain name for a module path, even if you are developing purely on your local filesystem. If you do not have a dot in your module paths and import paths, then some things work with modules, but other things don't. See for example #27503, including this #27503 (comment) from @bcmills:
Note that in general, you can do local development with inter-related modules without a remote git server. Here is a an example
which is from a more complete and runnable example here. Does that give you want you are looking for? Note that is just going to use whatever is on the filesystem (e.g., it will use whatever files you would see if you were to I'm not sure that is want you want, though, because it sounds like you might want to do local development without a remote git server, but where version information is still specified? To my knowledge, if you try to do something like specify a version with a local directory on the right side of a replace statment: then you will get an error such as: Finally, I noticed that in some of your examples you were specifying the version on the left side of a replace statement. That is allowed, but not required, and usually not desired (because it makes the replace statement less robust if a version later changes). In any event, sorry if this is not 100% helpful, but I was curious if any of the above might hint towards a solution that works for you. |
Thank you @thepudds. There is no better solution.
To solve it, any developer can build his own tools with git API and choose automatically desired version of git repository or git clone. |
What version of Go I am using (
go version
)?Go 1.11.1 (go/vgo)
My company doesn't use HTTP protocol.
My company only uses UNIX sockets.
All the development is centralized.
I want support several versions of projects/packages with git (local repository) through modules.
The go documentation says that go understand git tags but I'm not seeing it.
Example:
I have a local module named
x
(without domain name).This module have two branches (master and v2). Each branch have last commit tags:
v1.2.0
andv2.2.0
Now I'm creating a second project/module named
y
. This project imports x module and when I'm trying to build it give me an error because go wants a goproxy or domain name.To solve this issue I'm using inside go.mod:
replace x v2.2.0 => ../x
Note: project name and module is the sameBut the
replace
for me is a hack because go doesn't automatically detect the versions. I can specify any fake path with different version.My question is: How I can use local git repository instead remote git repository without proxy?
For example:
Module y imports module x using its git repo (or existent clone) and automatically detects the tag version when specify vx.x.x inside go.mod
Note: Doing replace x v.2.2.0 => path is unnecessary work. Is faster avoiding modules and using older dependency specifying the path of existing project. (Is the same as modules with replace but doing less work)
The text was updated successfully, but these errors were encountered: