Package is not in GOROOT for local package in module for golang 1.19

Viewed 41

Here is my directory structure

    myapp/
        go.mod
        mymodule/
            main.go
            mypackage/
                mypackage.go

mypackage.go

package mypackage

import "fmt"

func MyFunc() {
    fmt.Println("hellow")
}

main.go

package main

import "myapp/mypackage"


func main() {
    mypackage.MyFunc()
}

Currently I am in myapp/mymodule when I go build I run into

package myapp/mymodule is not in GOROOT

I am using golang 1.19

What is the proper setup for importing sub package in local to the parent module?

0 Answers
Related