English Chinese (Simplified)
Advanced uses cases
Shipping additional files
If you need to ship additional files in your source code packages, you can use the following macros in the preamble:
`+%global goextensions+` A space separated list of extensions that should
be included in the devel package in addition to
Go default file extensions.
`+%global gosupfiles+`: A space-separated list of shell globs matching
other files to include in the devel package.
`+%global gosupfilesex+` A space-separated list of shell globs matching
other files you wish to exclude from package lists.
Only works with “gosupfiles”-specified files.
For example, if you have glide files to ship:
%global gosupfiles glide.yaml glide.lock
Additional header declarations
Use `+%godevelheader+` to add specific subpackage declarations. For example, you might want to require the main package containing the binaries, or Obsoletes/Provides another package in case of renaming.
%global godevelheader %{expand:
Requires:
Obsoletes:
Provides:
}
Dealing with cyclic dependencies
In many cases, you'll encounter packages that depend on each other, also known as cyclic dependencies, making it difficult to build either package.
Typically, when you have a problematic requires, it is only used in specific project subpackages, and most project dependents do not need those subpackages directly or indirectly. The idea is then to affect the goipaths associated with the problematic subpackages to a separate -devel rpm package, to simplify your dependency graph.
Let's take for example the following packages: `+cloud.google.com/go+` and `+golang.org/x/oauth2+`.
`+cloud.google.com/go+` has the following dependency graph:
github.com/golang/mock/gomock
github.com/golang/protobuf/proto
github.com/golang/protobuf/ptypes
github.com/golang/protobuf/ptypes/any
github.com/golang/protobuf/ptypes/duration
github.com/golang/protobuf/ptypes/empty
github.com/golang/protobuf/ptypes/struct
github.com/golang/protobuf/ptypes/timestamp
github.com/golang/protobuf/ptypes/wrappers
github.com/google/btree
github.com/google/go-cmp/cmp
github.com/google/martian
github.com/google/martian/fifo
github.com/google/martian/httpspec
github.com/google/martian/martianhttp
github.com/google/martian/martianlog
github.com/google/martian/mitm
github.com/google/pprof/profile
github.com/googleapis/gax-go/v2
go.opencensus.io/plugin/ocgrpc
go.opencensus.io/stats
go.opencensus.io/stats/view
go.opencensus.io/tag
go.opencensus.io/trace
golang.org/x/build/kubernetes
golang.org/x/build/kubernetes/api
golang.org/x/build/kubernetes/gke
golang.org/x/oauth2
golang.org/x/oauth2/google
golang.org/x/oauth2/jwt
golang.org/x/sync/errgroup
golang.org/x/sync/semaphore
golang.org/x/text/language
golang.org/x/time/rate
[…]