Skip to content

Commit

Permalink
fix(goreleaser): replace block name containing underscore (#511)
Browse files Browse the repository at this point in the history
* fix(goreleaser): replace block name containing underscore

* simplify replace command

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

---------

Co-authored-by: Mark Lee <malept@users.noreply.github.com>
  • Loading branch information
yj-yan and malept committed May 23, 2024
1 parent 6835c02 commit ecaf59e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 27 deletions.
19 changes: 8 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ require (
golang.org/x/mod v0.17.0
)

require (
github.com/google/go-github/v62 v62.0.0 // indirect
golang.org/x/sync v0.7.0 // indirect
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/AlecAivazis/survey/v2 v2.3.7 // indirect
Expand All @@ -43,40 +38,42 @@ require (
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-github/v62 v62.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/ulikunitz/xz v0.5.12 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/zalando/go-keyring v0.2.4 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
Expand Down
21 changes: 7 additions & 14 deletions go.sum

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

3 changes: 1 addition & 2 deletions templates/.goreleaser.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ builds:
{{- end }}
env:
- CGO_ENABLED={{ stencil.ApplyTemplate "cgoEnabled" | trim }}
{{- $cmd := $cmdName | split "-" }}
{{- $blockName := (printf "%vAdditionalEnv" ($cmdName | replace "-" "")) }}
{{- $blockName := (printf "%vAdditionalEnv" ($cmdName | replace "-" "" | replace "_" "")) }}
## <<Stencil::Block({{ $blockName }})>>
{{ (file.Block $blockName) | trim }}
## <</Stencil::Block>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ builds:
- CGO_ENABLED=0
## <<Stencil::Block(cmd3sub2AdditionalEnv)>>

## <</Stencil::Block>>
- main: ./cmd/cmd4_sub1
id: &name cmd4_sub1
binary: *name
goos:
- linux
- darwin
goarch:
- amd64
- arm64
ldflags:
- '-w -s -X "github.com/getoutreach/gobox/pkg/app.Version=v{{ .Version }}"'
- '-X "main.HoneycombTracingKey={{ .Env.HONEYCOMB_APIKEY }}"'
- '-X "main.TeleforkAPIKey={{ .Env.TELEFORK_APIKEY }}"'
env:
- CGO_ENABLED=0
## <<Stencil::Block(cmd4sub1AdditionalEnv)>>

## <</Stencil::Block>>

archives: []
Expand Down
1 change: 1 addition & 0 deletions templates/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ func TestGoreleaserYml(t *testing.T) {
"cmd2",
"cmd3-sub1",
"cmd3-sub2",
"cmd4_sub1",
},
})
st.Run(true)
Expand Down

0 comments on commit ecaf59e

Please sign in to comment.