API to call go mod commands as library functions?


(Jeff Kowalczyk) #1

Is there a public API to call go mod commmands as library functions? I haven’t seen this mentioned in modules discussions or documentation. No worries if the API isn’t marked stable yet, I’m only asking if there is or will be an API.

I need to develop a tool to automate sequences of commands from go mod {vendor, download, verify} and report overall success or failure as a return value, plus actionable error output.

Calling go mod commands via shell is one option, but I’d like to consider calling the functions directly for better control flow and to avoid parsing output.