1

I have a Golang project with one git submodule like follows:

Project

  • go.mod
  • main.go
  • config.go
  • go-blockchain/ (git Submodule)
    • go.mod
    • crypto/
      • encode.go (This has cgo code in it)
      • crypto.go
    • main.go

When I run go build at the top level, I get errors like:

# github.com/blockchain/go-blockchain/crypto

/Users/niceguy/.go/pkg/mod/github.com/blockchain/go-blockchain@v0.0.0-20200320145517-cea8009ba7ee/crypto/encode.go:86:2: could not determine kind of name for C.crypto_encode_pair

/Users/niceguy/.go/pkg/mod/github.com/blockchain/go-blockchain@v0.0.0-20200320145517-cea8009ba7ee/crypto/encode.go:80:2: could not determine kind of name for C.crypto_encode_from_seed

/Users/niceguy/.go/pkg/mod/github.com/blockchain/go-blockchain@v0.0.0-20200320145517-cea8009ba7ee/crypto/encode.go:115:9: could not determine kind of name for C.crypto_encode_proof_to_hash

The problem appears to be that I'm favoring the cache over the CGO libraries that are built and deposited back in the go-blockchain folder.

Suggestions?

Outerdev
  • 21
  • 3
  • Has this question stumped the internets? – Outerdev Mar 23 '20 at 00:46
  • I found the answer. I had two separate module addresses in the Golang code referring to the same git submodule. I had: github.com/niceguy/myblockchain-proj/go-blockchain AND github.com/blockchain/go-blockchain The answer was to always use the original Golang address of the submodule in the Golang code: github.com/blockchain/go-blockchain and use a _replace_ in go.mod – Outerdev Mar 23 '20 at 10:21

0 Answers0