Skip to content

vendor: go build error when there are multi instances of one package in vendor/ #73

@hilyjiang

Description

@hilyjiang

I just try to build my project with GO15VENDOREXPERIMENT support with glide.
But I found there is something wrong when build it.

Code Tree:

# tree 
.
├── main.go
└── vendor
    ├── a
    │   └── a.go
    └── b
        ├── b.go
        └── vendor
            └── a
                └── a.go
# find .
.
./vendor
./vendor/b
./vendor/b/b.go
./vendor/b/vendor
./vendor/b/vendor/a
./vendor/b/vendor/a/a.go
./vendor/a
./vendor/a/a.go
./main.go

vendor/a and vendor/b/vendor/a are same package.

vendor/a/a.go

package a

type T struct {
    Name string
}

func Test() *T {
    return &T{"a"}
}

vendor/b/b.go

package b

import (
    "a"
)

func Test() *a.T {
    return &a.T{"b"}
}

main.go

package main

import (
    "a"
    "b"
    "fmt"
)

func main() {
    var t1, t2 *a.T
    t1 = a.Test()
    t2 = b.Test()
    fmt.Println(t1, t2)
}

When run go build, error occur:

# go build
# c
./main.go:12: cannot use b.Test() (type *"c/vendor/b/vendor/a".T) as type *"c/vendor/a".T in assignment

Is this Go's problem or Glide's?
Is there other good way to manage those relationships between packages?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions