Skip to content

Commit

Permalink
Merge pull request #1087 from tarcinil/feature/workstation-using-dist
Browse files Browse the repository at this point in the history
adding gen for dist, using dist in the executables
  • Loading branch information
tyler-ball authored Apr 15, 2020
2 parents 0affa42 + 1b2635e commit a1f6dd6
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
14 changes: 14 additions & 0 deletions components/main-chef-wrapper/dist/gen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// +build generate
//go:generate go run github.com/chef/go-libs/distgen global.go dist
//
// Copyright 2020 Chef Software, Inc.
// Author: Salim Afiune <afiune@chef.io>
//
// This file will be ignored at build time, but included for dependencies,
// it automatically generates a 'global.go' with a set of global variables

package dist

import (
_ "github.com/chef/go-libs/distgen"
)
30 changes: 30 additions & 0 deletions components/main-chef-wrapper/dist/global.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/main-chef-wrapper/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/chef/chef-workstation/components/main-chef-wrapper
go 1.13

require (
github.com/chef/go-libs v0.2.0
github.com/chef/go-libs v0.4.0
github.com/pkg/errors v0.9.1 // indirect
)
3 changes: 3 additions & 0 deletions components/main-chef-wrapper/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/chef/chef-workstation v0.0.0-20200409205805-97040ae5cf4e h1:4wuaXNcUc7+r1kbPKesMpkcb6ZELICVuefFV3FHgpLY=
github.com/chef/go-libs v0.1.0 h1:ljwMsGhp0tjnsjn7g9aZSTQgjzjn+vfVZpkzJh0wmOQ=
github.com/chef/go-libs v0.1.0/go.mod h1:aGHwP5PXYdD0hVq+jodILnSqB/b04EhS/XCoqhE2PrA=
github.com/chef/go-libs v0.2.0 h1:9/YU0CFKpN8PvlVJGo8E3XfzPc+AU3lpmm/ziR54FrQ=
github.com/chef/go-libs v0.2.0/go.mod h1:aGHwP5PXYdD0hVq+jodILnSqB/b04EhS/XCoqhE2PrA=
github.com/chef/go-libs v0.4.0 h1:FoiI9dRPLKp9bxxRiuFf+at8gG91tyttK53FM9+y0sw=
github.com/chef/go-libs v0.4.0/go.mod h1:aGHwP5PXYdD0hVq+jodILnSqB/b04EhS/XCoqhE2PrA=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
Expand Down
6 changes: 4 additions & 2 deletions components/main-chef-wrapper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"os/exec"

"github.com/chef/go-libs/featflag"
"github.com/chef/chef-workstation/components/main-chef-wrapper/dist"

)

func main() {
Expand All @@ -43,7 +45,7 @@ func main() {
// Both ways would be running the same underlying binary.
case "analyze":
if featflag.ChefFeatAnalyze.Enabled() {
cmd = exec.Command("chef-analyze", allArgs...)
cmd = exec.Command(dist.AnalyzeExec, allArgs...)
} else {
fmt.Printf("`%s` is experimental and in development.\n\n", featflag.ChefFeatAnalyze.Key())
fmt.Printf("Temporarily enable `%s` with the environment variable:\n", featflag.ChefFeatAnalyze.Key())
Expand Down Expand Up @@ -72,7 +74,7 @@ func main() {
// When we land in the default case where we run the old 'chef' cli binary,
// we need to send the sub-command as well as all the arguments.
allArgs = append([]string{subCommand}, allArgs...)
cmd = exec.Command("chef-cli", allArgs...)
cmd = exec.Command(dist.WorkstationExec, allArgs...)
}

debugLog(fmt.Sprintf("Chef binary: %s", cmd.Path))
Expand Down

0 comments on commit a1f6dd6

Please sign in to comment.