I'm trying to build and run a repo (https://github.com/hyperledger/fabric/tree/master) but this error keeps popping up and still I haven't found a solution to this.
consensus.go:12:2: use of internal package github.com/hyperledger/fabric/internal/pkg/identity not allowed
This is just one of many files that give this error. I'm pretty sure I'm doing something wrong since this repo is suppose to be working.
Go version :
go version go1.13.5 linux/amd64
OS : Linux Mint 19.2 Cinnamon
Internal packages (packages that are inside a folder that has an
internalfolder in their path) can only be imported from packages rooted at the parent of theinternalfolder.E.g. a package
pkg/foo/internal/barcan be imported by the packagepkg/foo/internal/bazand also frompkg/foo/baz, but cannot be imported by the packagepkgnor can it be imported bypkg/bar. This is by design. This is so big, complex packages can be broken into smaller packages without having to expose internals.You have to treat internal packages as "private" or non-existent from the "outside".
See related: Can I develop a go package in multiple source directories?
Read more about internal packages at Command go: Internal Directories.
Internal packages are a compiler restriction. If you want to expose them (if you want to use an internal package) in your own project, you have to remove the
internalfolder, and then of course you have to change the imports (import paths) too.