I am at this time creating more and more of small one-off projects in golang but I see many makefile tasks are literally copy&paste from across projects. For example, in every project I have a:
${APP_NAME}: $(SOURCES)
go get ./...
goimports -w $(SOURCES)
go build -o ${APP_NAME}
I would like to know if anyone has experience of fragment extraction into a separate project and importing it. If so, how do you do it?
Just curl a file from raw.githubusercontent.com
? Because that's what I'm about to do since I don't see any other easy way.
I also thought about using git submodules but that seems also a bit over the top for a couple of files.
I have found a simple workaround: I include
Makefiles which I made from the starting monolithic Makefile.
I am putting split Makefiles in a separate git project, that contains only them.
I am referring to those Makefiles from root project and I have them locally via git submodule. A bit more work - yes, but it allows me to have trivial "root" Makefile and all hard (quite often - repeating) logic in the separate project.
Example of how I made this work: