flowerinthenight / golang-monorepo

An example of a golang-based monorepo.
MIT License
386 stars 37 forks source link

Reference local package #1

Closed KentBrockman closed 5 years ago

KentBrockman commented 5 years ago

Hey @flowerinthenight

I'm wondering about how you reference local packages.

I see you reference pkg/utils at samplesvc/main.go:7 directly from github. Done this why, pkg/util will be downloaded from github using the new go modules behaviour - is my understanding there correct?

Say I have a case where I'd like to make some experimental changes to pkg/utils - would I have to push those experimental changes up to github before they become available to samplesvc? Or will sampelsvc just reference it locally?

Thanks for putting this monorepo together :) And thanks for your help!

flowerinthenight commented 5 years ago

Hi,

I think referencing here is the normal way of referencing local packages in Go. Whether monorepo or not, or whether Go modules or pre-Go modules. It should build just fine locally.

KentBrockman commented 5 years ago

You're right.

Adding a new exported function to pkg/utils/glogerr2.go becomes immediately available to samplesvc without downloading anything. Seems like magic to me Thanks