You are right, when changing import paths, related info (go.mod contents in 
this case) need to be updated as well. This was missing from my answer, 
thanks for catching that.

Glad to hear that go-getting the private module works after including the 
VCS extension.

On Monday, September 26, 2022 at 8:39:33 PM UTC+2 Rich wrote:

> After I posted this on Friday I saw about adding .git to the end, and that 
> didn't work. Then it started saying:
>
> repository.web.mycompany.com/st_nsres.git 
> but package is
> repository.web.mycompany.com/st_nsres 
> <http://repository.web.mycompany.com/st_nsres.git>
>
> Or something like that. What I had to do was delete the go.mod of 
> repository.web.mycompany.com/st_nsres 
> <http://repository.web.mycompany.com/st_nsres.git>, reinitialize go mod 
> init repository.web.mycompany.com/st_nsres.git. I then pushed that, 
> created a tag:
> git tag "v0.1.1", then git push origin "v0.1.1". 
>
> Then in the application I built that used that package I had to go get "
> repository.web.mycompany.com/st_nsres.git". --THEN it started working.
>
> When I look at the source code to go get  -- MAN the work the Go authors 
> put into that is pretty amazing. Does anybody think it might be possible to 
> write a go git command that might do the same things go get does but ... 
> just for git?  In the days before go mod, I could just go into my goroot: 
> go/src/repository.web.mycompany.com/ then do a git pull 
> repository.web.mycompany.com/st_nsres.git. From there Go would look for 
> it there and you wouldn't need to do a go get on it. I am not sure where it 
> stores it today, if it were possible to somehow cache it manually like that?
>
> Thanks for the help Christoph!!!
>
>
> On Sunday, September 25, 2022 at 7:20:48 AM UTC-4 christoph...@gmail.com 
> wrote:
>
>> Hi Rich,
>>
>> I guess, you run into the behavior described here 
>> <https://pkg.go.dev/cmd/go#hdr-Remote_import_paths>:
>>
>>
>> *> To declare the code location, an import path of the form>     *
>> repository.vcs/path
>> *> specifies the given repository, with or without the .vcs suffix, using 
>> the named version control system, and then the path inside that repository.*
>> *> (...)*
>> *> If the import path is not a known code hosting site and also lacks a 
>> version control qualifier, the go tool attempts to fetch the import over 
>> https/http and looks for a <meta> tag in the document's HTML <head>. *
>> (emphasis mine)
>>
>> So it seems the go get command does not recognize the import path to be a 
>> Git repository. Otherwise it would have tried SSH, too.
>>
>> I would try changing the import path to 
>> repository.web.mycompany.com/st_nsres.git to give go get a hint that the 
>> import path is a Git repo.
>>
>> On Saturday, September 24, 2022 at 1:14:45 AM UTC+2 Rich wrote:
>>
>>> Sorry the last line was messed up.
>>>
>>> The error I get is:
>>>  github.com/stretchr/testify/require: 
>>> repository.web.mycompany.com/st_nsres@     v0.2.0: unrecognized import 
>>> path "repository.web.mycompany.com/st_nsres":       https fetch: Get "
>>> https://repository.web.mycompany.com/st_nsres?go-get=1":      Unable to 
>>> connect
>>>
>>> It keeps trying to connect via https -- IT's SSH
>>> Again I have ~/.gitconfig configured:
>>>
>>> [url "ssh://g...@internal.repository.web.mycompany.com:7999/ 
>>> <http://g...@internal.repository.web.mycompany.com:7999/>"]
>>>      insteadOf = https://repository.web.mycompany.com/
>>>
>>> And GOPRIVATE set to repository.web.mycompany.com
>>> On Friday, September 23, 2022 at 4:59:44 PM UTC-4 Rich wrote:
>>>
>>>> I have been having a really hard time with Go Get It just isn't 
>>>> working. We have a private Repositiory, that repository requires us to use 
>>>> SSH. There is no option for using https.
>>>>
>>>> So, I've configured my git config "~/.gitconfig' 
>>>>
>>>> ```
>>>> [url "ssh://g...@internal.repository.web.mycompany.com:7999/ 
>>>> <http://g...@internal.repository.web.mycompany.com:7999/>"]
>>>>      insteadOf = https://repository.web.mycompany.com/
>>>> ```
>>>> I have GOPRIVATE set
>>>> ```
>>>> export GOPRIVATE="repository.web.mycompany.com"
>>>> ```
>>>> Then when I use go get:
>>>> ```
>>>> repository.web.mycompany.com
>>>> ```
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e4b00b73-ee52-4049-91d2-a00c9830381en%40googlegroups.com.

Reply via email to