Issues with interfaces using vendored code
- Dominant language
- Go
- Stars
- 9.5k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Since cfssl includes a vendor directory, if I have an external application that attempts to implement cfssl's Source interface like so:
```go
import (
"crypto"
"crypto/x509"
cfocsp "github.com/cloudflare/cfssl/ocsp"
"golang.org/x/crypto/ocsp"
)
type SimpleSource struct {
responder *x509.Certificate
key crypto.Signer
status int
ttl time.Duration
}
func (src *SimpleSource) Response(request *ocsp.Request) ([]byte, http.Header, error) {
// ...
}
```
the compiler complains about the following:
```
./main.go:122:2: cannot use src (type SimpleSource) as type "github.com/cloudflare/cfssl/ocsp".Source in return argument:
SimpleSource does not implement "github.com/cloudflare/cfssl/ocsp".Source (wrong type for Response method)
have Response(*"golang.org/x/crypto/ocsp".Request) ([]byte, http.Header, error)
want Response(*"github.com/cloudflare/cfssl/vendor/golang.org/x/crypto/ocsp".Request) ([]byte, http.Header, error)
```
If I remove the vendor directory from cfssl, it works.
In general, Go libraries **should not** use vendor directories. Vendor directories should only be used by applications.
Contributor guide
Assessment
This issue has not been assessed yet.