I am struggling to setup a local Mercurial repository for go packages.
All mercurial package directories can are under the following url:
https://server.example.com/go-packages/
I can clone a package via:
hg clone https://server.example.com/go-packages/packagename
That works fine.
When I want to install the package with the go
command line:
go get server.example.com/go-packages/packagename
I get the following error:
package server.example.com/go-packages/packagename: unrecognized import path "server.example.com/go-packages/packagename"
But when I do it as explained in http://golang.org/cmd/go/ :
go get server.example.com/go-packages/packagename.hg
It works perfectly.
In the above document they talk about a <meta>
flag. So I created a index.html with the following entry:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="go-import" content="import-prefix hg repo-root">
<title>packagename</title>
</head>
<body>
<h1>packagename</h1>
</body>
</html>
Update:
When I do a wget -O- https://server.example.com/go-packages/packagename/?go-get=1 --no-check-certificate
I get:
!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="go-import" content="import-prefix hg repo-root">
<title>packagename</title>
</head>
<body>
<h1>packagename</h1>
</body>
</html>
Update 2
I saw, that my content was wrong (copy paste error) now I changed it to:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="go-import" content="server.example.com/go-packages/packagename hg https://server.example.com/go-packages/packagename" />
<title>packagename</title>
</head>
<body>
<h1>packagename</h1>
</body>
</html>
Where go-packages
is a directory containing the mercurial repository packagename
.
But still go get server.example.com/go-packages/packagename
is not working.