Skip to content

Commit

Permalink
Setup CI (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
  • Loading branch information
jpkrohling authored Oct 14, 2020
1 parent d82e775 commit feb5866
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Go

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Test
run: go test -v ./...

- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.29
only-new-issues: true

8 changes: 6 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@ func Execute() {
cmd.Flags().StringVar(&cfg.Distribution.Module, "module", "github.com/jpkroehling/opentelemetry-collector-builder", "The Go module for the new distribution")

// tie Viper to flags
viper.BindPFlags(cmd.Flags())
if err := viper.BindPFlags(cmd.Flags()); err != nil {
cfg.Logger.Error(err, "failed to bind flags: %w", err)
}

cmd.Execute()
if err := cmd.Execute(); err != nil {
cfg.Logger.Error(err, "failed to run: %w", err)
}
}

func initConfig() {
Expand Down
4 changes: 4 additions & 0 deletions internal/builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ func Compile(cfg Config) error {

func processAndWrite(cfg Config, tmpl string, outFile string, tmplParams interface{}) error {
t, err := template.New("template").Parse(tmpl)
if err != nil {
return err
}

out, err := os.Create(filepath.Join(cfg.Distribution.OutputPath, outFile))
if err != nil {
return err
Expand Down

0 comments on commit feb5866

Please sign in to comment.