Skip to content

Commit

Permalink
Add replaces directive (#10)
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
  • Loading branch information
jpkrohling authored Oct 19, 2020
1 parent 5d14976 commit 201ee33
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ The `import` might specify a more specific path than what is specified in the `g

The `name` will typically be omitted, except when multiple components have the same name. In such case, set a unique name for each module.

Optionally, a list of `go mod` replace entries can be provided, in case custom overrides are needed. This is typically necessary when a processor or some of its transitive dependencies have dependency problems.

```yaml
dist:
module: github.com/observatorium/opentelemetry-collector-builder # the module name for the new distribution, following Go mod conventions. Optional, but recommended.
Expand All @@ -80,4 +82,7 @@ exporters:
import: "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alibabacloudlogserviceexporter" # the import path for the component. Optional.
name: "alibabacloudlogserviceexporter" # package name to use in the generated sources. Optional.
path: "./alibabacloudlogserviceexporter" # in case a local version should be used for the module, the path relative to the current dir, or a full path can be specified. Optional.
replaces:
# a list of "replaces" directives that will be part of the resulting go.mod
- github.com/open-telemetry/opentelemetry-collector-contrib/internal/common => github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.12.0
```
1 change: 1 addition & 0 deletions internal/builder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Config struct {
Extensions []Module `mapstructure:"extensions"`
Receivers []Module `mapstructure:"receivers"`
Processors []Module `mapstructure:"processors"`
Replaces []string `mapstructure:"replaces"`
}

// Distribution holds the parameters for the final binary
Expand Down
3 changes: 3 additions & 0 deletions internal/scaffold/gomod.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ require (
{{- range .Processors}}
{{if ne .Path ""}}replace {{.GoMod}} => {{.Path}}{{end}}
{{- end}}
{{- range .Replaces}}
replace {{.}}
{{- end}}
`

0 comments on commit 201ee33

Please sign in to comment.