3

I have a package which is forked from a repository myproject. Inside the project, I want to use some functions from sha3 package, however, I need to first add a go file to sha3 package which contains some extra functionalities. I want to include this custom sha3 package inside my project. I copied and pasted the sha3 directory into myproject directory, and inside my go codes, I imported sha3 package as: import . "github.com/myproject/sha3". Now, when I try to build myproject package, I am getting: code in directory /src/github.com/myproject/sha3 expects import "golang.org/x/crypto/sha3". I cannot understand what the problem is. I checked all the go files inside sha3 directory and none of them requires any import!

Anuruddha
  • 3,187
  • 5
  • 31
  • 47
A23149577
  • 2,045
  • 2
  • 40
  • 74

1 Answers1

7

line number 66 sha3/docs.go has the import comment.

import "golang.org/x/crypto/sha3"

You can get rid of the build error by removing that.

Anuruddha
  • 3,187
  • 5
  • 31
  • 47
  • 2
    OMG! I certainly did not know it considers comments as well! You're a lifesaver! – A23149577 Feb 06 '18 at 05:44
  • 1
    @A23149577: see the [Import Path Checking documentation](https://golang.org/cmd/go/#hdr-Import_path_checking) – JimB Feb 06 '18 at 13:59