Skip to content

Commit

Permalink
Merge pull request #5 from alk-xchassin/master
Browse files Browse the repository at this point in the history
Add the linter to the CI + the git diff
  • Loading branch information
alk-xchassin authored Aug 7, 2020
2 parents 0a93f21 + a6ee1a5 commit de3bf80
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 24 deletions.
35 changes: 21 additions & 14 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,35 @@ name: Test

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

jobs:

build:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
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: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
id: go
- name: Get dependencies
run: go mod download

- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Test
run: go test -vet=off ./...

- name: Get dependencies
run: go mod download
- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.30

- name: Test
run: go test -vet=off ./...
- name: Check diffs
# --name-only first for debugging
run: git diff --name-only && git diff --quiet
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
tags:
- "*"

jobs:
build:
name: Release
runs-on: ubuntu-latest
steps:
- name: Set up Go
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
with:
fetch-depth: 0

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
run:
deadline: 8m
build-tags:
- codeanalysis

linters:
enable:
- gosec # (gas) Inspects source code for security problems
- nolintlint # Reports ill-formed or insufficient nolint directives
- unconvert # Remove unnecessary type conversions
- whitespace # Tool for detection of leading and trailing whitespace
- gofumpt # Gofumpt checks whether code was gofumpt-ed
- prealloc # Finds slice declarations that could potentially be preallocated
6 changes: 6 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
project_name: mylib-go
build:
skip: true
release:
github:
prerelease: auto
2 changes: 1 addition & 1 deletion example/nodes/math.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func Adder(a, b int) (sum int) { return a + b }
func Multiplier(a, b int) (product int) { return a * b }

func RandomIntProducer() (n int) {
return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(100)
return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(100) //nolint:gosec // not really critical
}

// IntAggregator aggregates `list` using `reducer.
Expand Down
2 changes: 1 addition & 1 deletion wrappers/bind/graph/bind.go

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

2 changes: 1 addition & 1 deletion wrappers/constants/graph/constants.go

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

2 changes: 1 addition & 1 deletion wrappers/ctx/graph/ctx.go

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

2 changes: 1 addition & 1 deletion wrappers/gonodes/graph/gonodes.go

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

2 changes: 1 addition & 1 deletion wrappers/ifs/graph/ifs.go

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

2 changes: 1 addition & 1 deletion wrappers/inputs/graph/inputs.go

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

2 changes: 1 addition & 1 deletion wrappers/mockingjay/graph/mockingjay.go

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

2 changes: 1 addition & 1 deletion wrappers/outputs/graph/outputs.go

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

2 changes: 1 addition & 1 deletion wrappers/types/graph/types.go

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

0 comments on commit de3bf80

Please sign in to comment.