Cannot import a package defined in own Go module

I have this directory structure -

go 
  |
  arrays
    |
    go.mod
    main.go
    twosum
     |
     twosum.go

I am trying to import the TwoSum function I created in the directory (package) twosum, inside the main.go file in the arrays module - using import "arrays/twosum"

But I keep getting an error that the import is not found. I’m not even sure what I’m doing wrong, I followed the same order defined here - How to Use Go Modules | DigitalOcean as an example.

Enter your project name first

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.