0

I use golang Masterminds/glide to manage package. here is my project:

$GOPATH/    
      bin/  
      pkg/
      src/
         go_test/
            long(own custom package: just print a "hello")  
            main.go  
            glide.yaml  
            vendor/  
                github.com/lib/pq   

the long package is used in main.go like :

 package main 
   import(
    "database/sql"
    "github.com/lib/pq"
    "long"
  )
  func main(
    ...
  }

the glide.yaml is:

package:  go_test
import:   
- package: github.com/lib/pq 

  when go run main.go the error is: can not found package long . if I put the long package into the vendor/ and then glide up
 it will show can not detect vcs about the "long" dependencies. but can run with project.
 so I want to know how to set that glide will skip the long package detect and the project can run .

note: I use the ignore: in the yaml. if add long to ignore .the project will can run because can't find long package.

4

1 回答 1

0

因为正确的包名称是从/src项目中的目录开始的完整路径,所以应该"go_test/long""long"你的import语句中使用。并且因为它是您自己的代码而不是供应商依赖项,所以它不能在vendor目录下。

于 2017-07-31T09:52:19.267 回答