It depends what you're trying to achieve. In the simplest case, is this all 
one project in one repo, but broken into packages?  In that case,  you can 
just "go mod init" in the top-level directory, and then you create your 
dependent packages in subdirectories (without go.mod files).

Here I just used "go mod init foo", "mkdir bar", and created main.go and 
bar/greet.go

==> go.mod <==
module foo

go 1.16

==> main.go <==
package main

import (
"fmt"
"foo/bar"
)

func main() {
fmt.Println(bar.Greeting)
}

==> bar/greet.go <==
package bar

const Greeting = "Hello world!"


$ go run .
Hello world!

You don't need to vendor anything unless you're importing third-party code 
from other repositories.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f4617546-35b6-4574-b539-b11f5f59b3c5n%40googlegroups.com.

Reply via email to