I have a protobuf-repository with a single go-file in its root, which contains the following:
//go:generate ./scripts/generate_go_sources.sh
package protobuf
The mentioned script goes through all .proto
files in a "message/" subfolder, and generates the go-sources.
Afterwards, the repository contains a lot of subpackages like
ptyes/package1/file.go
ptyes/package2/file.go
I do not want to check these files in to version control.
I'm trying to switch to go dep for dependency-management, but I cannot convince it to download this repository and execute "go generate".
Solving failure: No versions of github.com/company/protobuf met constraints:
master: Could not introduce github.com/company/protobuf@master, as it is not allowed by constraint vendoring from project github.com/company/myProject.
develop: Could not introduce github.com/company/protobuf@develop, as it is not allowed by constraint vendoring from project github.com/company/myProject.
vendoring: Could not introduce github.com/company/protobuf@vendoring due to multiple problematic subpackages:
Subpackage github.com/company/protobuf/ptypes/package1 is missing. (Package is required by (root).)
Subpackage github.com/company/protobuf/ptypes/package2 is missing. Package is required by: (root)
go dep discovers the correct repository (vendoring-branch), but discards it because it cannot find the required sub-packages. They are only here once "go generate" was called in the root package.
From the godep documentation about migration:
dep assumes that all generated code exists, and has been committed to the source.
Therefore, it seems to be impossible to do what I want. The solution is to create a repository which contains the generated sources, and make sure these sources are automatically generated and kept in-sync with the actual source data (in my case the raw *.proto files).
Since I cannot put the generated sources into the same repository as the source data, it is neccessary to completely synchronise these two repositories (same branches, same tags), so that the versions used by go dep are somehow useful when comparing with the actual repository, that only contains declarations.