2016-03-05 06:51



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:

    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 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.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • douzhi2017 douzhi2017 5年前

    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:

    点赞 评论 复制链接分享