Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit b6cbd59

Browse files
author
David Chung
authored
Conditionally include UCS plugin in core binary (#756)
Signed-off-by: David Chung <[email protected]>
1 parent e9318b7 commit b6cbd59

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ E2E_TESTS?=true
1414
#Source file target
1515
SRCS := $(shell find . -type f -name '*.go')
1616

17-
# Set the go build tags here. By default we disable building of libvirt
18-
GO_BUILD_TAGS?=nolibvirt
17+
# Set the go build tags here. By default we disable building of libvirt and ucs. Must be space-separated.
18+
GO_BUILD_TAGS?='nolibvirt noucs'
1919

2020
# Allow turning off function inlining and variable registerization
2121
ifeq (${DISABLE_OPTIMIZATION},true)

cmd/infrakit/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ import (
6363
_ "github.com/docker/infrakit/pkg/run/v0/tailer"
6464
_ "github.com/docker/infrakit/pkg/run/v0/terraform"
6565
_ "github.com/docker/infrakit/pkg/run/v0/time"
66-
_ "github.com/docker/infrakit/pkg/run/v0/ucs"
6766
_ "github.com/docker/infrakit/pkg/run/v0/vagrant"
6867
_ "github.com/docker/infrakit/pkg/run/v0/vanilla"
6968
_ "github.com/docker/infrakit/pkg/run/v0/vars"

cmd/infrakit/ucs.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build ucs
2+
3+
package main
4+
5+
import (
6+
_ "github.com/docker/infrakit/pkg/run/v0/ucs"
7+
)

pkg/cli/registry.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ func LoadAll(services *Services) ([]*cobra.Command, error) {
125125
// 'info' subcommands map to the each interface the plugin implements
126126
seen := map[string]*cobra.Command{}
127127

128-
list := []string{}
128+
interfaces := map[string]struct{}{}
129+
129130
for _, spi := range spis {
130-
list = append(list, spi.Encode())
131+
132+
interfaces[spi.Encode()] = struct{}{}
131133

132134
visitCommands(spi, func(buildCmd CmdBuilder) {
133135

@@ -150,6 +152,11 @@ func LoadAll(services *Services) ([]*cobra.Command, error) {
150152
})
151153
}
152154

155+
list := []string{}
156+
for k := range interfaces {
157+
list = append(list, k)
158+
}
159+
153160
command.Short = fmt.Sprintf("Access object %s which implements %s",
154161
name, strings.Join(list, ","))
155162

0 commit comments

Comments
 (0)