Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

dep init with self-git-website have some error #1061

Closed
chyroc opened this issue Aug 25, 2017 · 1 comment
Closed

dep init with self-git-website have some error #1061

chyroc opened this issue Aug 25, 2017 · 1 comment

Comments

@chyroc
Copy link

chyroc commented Aug 25, 2017

What version of Go (go version) and dep (git describe --tags) are you using?

➜  ~ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/chyroc/Code/Golang"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.8.3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.8.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9c/4l3qft3n6h92nq59qk53vqkw0000gn/T/go-build970425648=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
➜  ~ brew upgrade dep
Error: dep 0.3.0 already installed

What dep command did you run?

dep init -v
➜  cti git:(master) ✗ dep init -v
unable to deduce repository and source type for "git.meiqia.com/business_platform/idg/idg": 
unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL 
"http://git.meiqia.com/business_platform/idg/idg?go-get=1": Get 
http://git.meiqia.com/business_platform/idg/idg?go-get=1: EOF

What did you expect to see?

generate a Gopkg.toml and a Gopkg.lock file,and vendor folder.

What did you see instead?

no file,no folder, error info is showed above.

the sub-package do not matth the right url.

self-git-hub git.meiqia.com create the problem?

and i test the main.go:

package main

import (
	"golang.org/x/text/encoding"
	"fmt"
)

func main() {
	fmt.Printf("", encoding.ASCIISub)
}

and run dep init -v, and it successed...

➜  vvvvvvvvvvvvv dep init -v
Root project is "git.meiqia.com/business_platform/vvvvvvvvvvvvv"
 1 transitively valid internal packages
 1 external packages imported from 1 projects
(0)   ✓ select (root)
(1)	? attempt golang.org/x/text with 1 pkgs; 1 versions to try
(1)	    try golang.org/x/text@master
(1)	✓ select golang.org/x/text@master w/5 pkgs
  ✓ found solution with 5 packages from 1 projects

Solver wall times by segment:
     b-source-exists: 1m52.308276524s
         b-list-pkgs:    198.434418ms
              b-gmal:    166.767059ms
             satisfy:      2.626775ms
         select-atom:      1.430044ms
     b-list-versions:       432.458µs
            new-atom:       381.624µs
         select-root:       113.974µs
               other:        11.228µs
  b-deduce-proj-root:         3.248µs

  TOTAL: 1m52.678477352s

  Using master as constraint for direct dep golang.org/x/text
  Locking in master (ac87088) for direct dep golang.org/x/text

so, how can i solve the problem?

thank you.

@chyroc chyroc changed the title dep init with sub-package have some error dep init with self-git-website have some error Aug 25, 2017
@darkowlzz
Copy link
Collaborator

@chyroc hi, thanks for creating an issue for this. This looks like a support for private/enterprise patterns. There's discussion going on about the same in #286 .

The go get tool depends on some metadata from the code hosting service to determine some information it needs. cmd/go#Remote-import-paths describes the same in details.

Similarly, dep uses the same metadata from the code repos to resolve the source of repo. So, when you get the error

unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL

it means that the code repo is not compatibly setup with the go tools.

Since I don't have any personal experience with this, I'm not sure if the code hosting services provide some option to enable the metadata tags on the repo.

Also, I found this https://stackoverflow.com/questions/26347516/using-go-get-on-a-personal-git-repo might be a good workaround.

Hope this helps :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants