Skip to content

Commit

Permalink
fix issue where logger in GithubAction printed messges faster than fm…
Browse files Browse the repository at this point in the history
…t.Println
  • Loading branch information
kuritka committed Mar 17, 2021
1 parent 5e55b1a commit 6801aff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ create `.licignore` in project root
Install and run **GOLIC**
```shell
# GO 1.16
go install github.com/AbsaOSS/golic@v0.4.3
go install github.com/AbsaOSS/golic@v0.4.4
golic inject -c="2021 MyCompany ltd."
```

Expand Down
10 changes: 8 additions & 2 deletions cmd/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
package cmd

import (
"github.com/enescakir/emoji"
"net/url"
"os"

Expand All @@ -36,15 +37,20 @@ var injectCmd = &cobra.Command{
if _, err := os.Stat(injectOptions.LicIgnore); os.IsNotExist(err) {
logger.Error().Msgf("invalid license path '%s'",injectOptions.LicIgnore)
_ = cmd.Help()
os.Exit(0)
os.Exit(1)
}
if _,err := url.Parse(injectOptions.ConfigURL); err != nil {
logger.Error().Msgf("invalid config.yaml url '%s'",injectOptions.ConfigURL)
_ = cmd.Help()
os.Exit(0)
os.Exit(1)
}
i := inject.New(ctx, injectOptions)
exitCode = Command(i).MustRun()
if exitCode == 0 {
logger.Info().Msgf("%s%s%s done", emoji.Rocket, emoji.Rocket, emoji.Rocket)
} else {
logger.Info().Msgf("%s exit", emoji.FaceScreamingInFear)
}
},
}

Expand Down
6 changes: 0 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package cmd
import (
"context"
"fmt"
"github.com/enescakir/emoji"
"os"

"github.com/AbsaOSS/golic/utils/log"
Expand All @@ -48,11 +47,6 @@ var rootCmd = &cobra.Command{
}
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
if exitCode == 0 {
logger.Info().Msgf("%s%s%s done", emoji.Rocket, emoji.Rocket, emoji.Rocket)
} else {
logger.Info().Msgf("%s exit", emoji.FaceScreamingInFear)
}
os.Exit(exitCode)
},
}
Expand Down

0 comments on commit 6801aff

Please sign in to comment.