I have a simple Go library (~300 lines, mostly type declarations and nice methods and compatibility methods for gomobile etc., also pretty-printing scripts). The heart of the whole project are two regexes, placed in a separate file in my Go repository.
Now I want to port that simple library to Python, Java (Android), maybe Javascript. I want the regexes to rest in a single Git repository (maybe even the Golang one).
What is the best way to include the regexes at compile/build time as string constants? In case of Golang, it seems that the only way is to use go generate
, which generates source code files and could include those regexes from a plain text file. So I decided to make a separate Go source code file for easy parsing by other build tools in case of Python, Java, Javascript. I would appreciate any advice how to do it efficiently that way. I could also make a separate repository for two regexes and use git submodules
(or even treat it as a sepratate Go package in Go project).
But I've lost my hope for a pretty solution, and that's why I'm asking here and not on SO; how do you solve such problems? The simplest way would be to manually "cherry-pick" commits from each repository, setting author field manually.