Skip to content

Commit

Permalink
feat(*): add golangci-lint checker
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmtrek committed Aug 15, 2020
1 parent 8d13a6a commit 0fd055c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 26 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
name: Go
name: build and test

on:
push:
pull_request:
branches: [ master ]

jobs:

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

- name: Set up Go 1.14
uses: actions/setup-go@v2
with:
Expand All @@ -24,6 +22,11 @@ jobs:
- name: Build
run: go build -v .

- name: Lint
uses: golangci/golangci-lint-action@v1
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.29

- name: Run Unit tests.
run: go test ./... -v -covermode=count -coverprofile=coverage.txt
Expand All @@ -35,7 +38,7 @@ jobs:
file: ./coverage.txt

release:
name: Release
name: release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
Expand All @@ -45,8 +48,10 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v2

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
4 changes: 0 additions & 4 deletions runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,6 @@ func (c *config) buildDelay() time.Duration {
return time.Duration(c.Build.Delay) * time.Millisecond
}

func (c *config) fullPath(path string) string {
return filepath.Join(c.Root, path)
}

func (c *config) binPath() string {
return filepath.Join(c.Root, c.Build.Bin)
}
Expand Down
10 changes: 5 additions & 5 deletions runner/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (e *Engine) buildRun() {
var err error
if err = e.building(); err != nil {
e.buildLog("failed to build, error: %s", err.Error())
e.writeBuildErrorLog(err.Error())
_ = e.writeBuildErrorLog(err.Error())
if e.config.Build.StopOnError {
return
}
Expand Down Expand Up @@ -277,8 +277,8 @@ func (e *Engine) building() error {
stdout.Close()
stderr.Close()
}()
io.Copy(os.Stdout, stdout)
io.Copy(os.Stderr, stderr)
_, _ = io.Copy(os.Stdout, stdout)
_, _ = io.Copy(os.Stderr, stderr)
// wait for building
err = cmd.Wait()
if err != nil {
Expand All @@ -299,8 +299,8 @@ func (e *Engine) runBin() error {
})

go func() {
io.Copy(os.Stdout, stdout)
io.Copy(os.Stderr, stderr)
_, _ = io.Copy(os.Stdout, stdout)
_, _ = io.Copy(os.Stderr, stderr)
}()

go func(cmd *exec.Cmd, stdout io.ReadCloser, stderr io.ReadCloser) {
Expand Down
12 changes: 0 additions & 12 deletions runner/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,12 @@ func (e *Engine) buildLog(format string, v ...interface{}) {
})
}

func (e *Engine) buildDebug(format string, v ...interface{}) {
if e.debugMode {
e.buildLog(format, v...)
}
}

func (e *Engine) runnerLog(format string, v ...interface{}) {
e.logWithLock(func() {
e.logger.runner()(format, v...)
})
}

func (e *Engine) runnerDebug(format string, v ...interface{}) {
if e.debugMode {
e.runnerLog(format, v...)
}
}

func (e *Engine) watcherLog(format string, v ...interface{}) {
e.logWithLock(func() {
e.logger.watcher()(format, v...)
Expand Down

0 comments on commit 0fd055c

Please sign in to comment.