Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Commit

Permalink
Merge eb1effb into c9c53ca
Browse files Browse the repository at this point in the history
  • Loading branch information
obalunenko committed Nov 25, 2019
2 parents c9c53ca + eb1effb commit 1e24c5d
Show file tree
Hide file tree
Showing 305 changed files with 46,371 additions and 20,757 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Go
on: [push]
jobs:

vet:
name: Vet
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

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

- name: Get dependencies
run: go mod download

- name: Vet
run: go vet $(go list ./...)


test:
name: Test
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

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

- name: Get dependencies
run: go mod download

- name: Test
run: make test

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

- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

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

- name: Get dependencies
run: go mod download

- name: Build
run: make compile


32 changes: 32 additions & 0 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Reviewdog on Pull Request
on: [pull_request]
jobs:
reviewdog:
name: reviewdog
runs-on: ubuntu-latest
steps:
- name: Dump GitHub Context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "${GITHUB_CONTEXT}"

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

- name: Add $GOPATH/bin
run: |
echo ::add-path::$(go env GOPATH)/bin
- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Install linters
run: make dependencies

- name: Run reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make review
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*.dll
*.so
*.dylib

dist/
# Test binary, build with `go test -c`
*.test

Expand Down
128 changes: 122 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
linters:
enable-all: true
disable:
- gochecknoglobals

linters-settings:
errcheck:
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
check-type-assertions: true

# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: true

funlen:
lines: 60
statements: 40

gofmt:
simplify: true
govet:
check-shadowing: true
enable-all: true
golint:
min-confidence: 0
gocyclo:
Expand All @@ -15,15 +36,110 @@ linters-settings:
misspell:
locale: US
lll:
line-length: 140
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 120
# tab width in spaces. Default to 1.
tab-width: 1
nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
max-func-lines: 30
goimports:
local-prefixes: github.com/oleg-balunenko/logs-converter
unparam:
algo: cha
check-exported: false
prealloc:
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: false # Report preallocation suggestions on for loops, false by default
godox:
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
# might be left in the code accidentally and should be resolved before merging
keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
- NOTE
- OPTIMIZE # marks code that should be optimized before merging
- HACK # marks hack-arounds that should be removed before merging
- TODO
- BUG
- FIXME
dogsled:
# checks assignments with too many blank identifiers; default is 2
max-blank-identifiers: 2

whitespace:
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
wsl:
# If true append is only allowed to be cuddled if appending value is
# matching variables, fields or types on line above. Default is true.
strict-append: true
# Allow calls and assignments to be cuddled as long as the lines have any
# matching variables, fields or types. Default is true.
allow-assign-and-call: true
# Allow multiline assignments to be cuddled. Default is true.
allow-multiline-assign: true
# Allow declarations (var) to be cuddled.
allow-cuddle-declarations: false
# Allow trailing comments in ending of blocks
allow-trailing-comment: false
# Force newlines in end of case at this limit (0 = never).
force-case-trailing-whitespace: 0
gocritic:
enabled-checks:
- docStub
- rangeValCopy
- yodaStyleExpr
- appendAssign
- appendCombine
- caseOrder
- badCond
- commentedOutCode
- commentFormatting
- commentedOutImport
- dupArg
- dupBranchBody
- elseif
- emptyStringTest
- indexAlloc
- initClause
- captlocal
- weakCond
- deprecatedComment
- flagDeref
- flagName
- hugeParam
- ifElseChain
- nilValReturn
- rangeExprCopy
- ptrToRefParam
- underef
- unnecessaryBlock
- valSwap
settings: # settings passed to gocritic
captLocal: # must be valid enabled check name
paramsOnly: true
rangeValCopy:
sizeThreshold: 320
hugeParam:
sizeThreshold: 500
rangeExprCopy:
skipTestFuncs: true
underef:
skipRecvDeref: true

linters:
enable-all: true
disable:
- gochecknoglobals

run:
issues-exit-code: 1
tests: true
skip-dirs:
- vendor/
- vendor/
skip-files:
- \.pb\.go$

issues:
exclude-use-default: false
exclude:
# for "public interface + private struct implementation" cases only!
- exported func * returns unexported type *, which can be annoying to use

71 changes: 51 additions & 20 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,60 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
release:
github:
owner: oleg-balunenko
name: logs-converter

before:
hooks:
- go mod tidy

builds:
- binary: logs-converter
- id: cli
binary: logs-converter-cli
goos:
- darwin
- windows
- linux
- darwin
- windows
- linux
goarch:
- amd64
- 386
- amd64
- 386
- arm
env:
- CGO_ENABLED=0
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
archive:
format: tar.gz
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
name_template: "{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
files:
- LICENSE
- README.md
- CGO_ENABLED=0
main: ./cmd/logs-converter-cli
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.ShortCommit}}
- -X main.date={{.Date}}
- -X main.goversion={{.Env.GOVERSION}}

archives:
- id: cli
builds:
- cli
format: tar.gz
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
replacements:
amd64: 64-bit
386: 32-bit
darwin: macOS
linux: Tux
name_template: "{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
files:
- LICENSE
- README.md
- docker-compose.yml
- config-example.toml

checksum:
name_template: "{{ .ProjectName }}-{{ .Version }}-checksums.txt"

snapshot:
name_template: SNAPSHOT-{{ .Commit }}

changelog:
sort: asc
filters:
Expand All @@ -38,5 +63,11 @@ changelog:
- "^test:"
- "^dev:"
- "README"
- "^readme"
- "^scripts"
- "scripts:"
- Merge pull request
- Merge branch
- Rebase on master
- "^Makefile"
- "goreleaser"
42 changes: 42 additions & 0 deletions .reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# reviewdog.yml

runner:
golint:
cmd: golint $(go list ./... | grep -v /vendor/)
format: golint
level: error
govet:
cmd: go vet $(go list ./... | grep -v /vendor/)
format: govet
level: error
errcheck:
cmd: errcheck -asserts -ignoretests -blank $(go list ./... | grep -v /vendor/)
errorformat:
- "%f:%l:%c:%m"
level: error
staticcheck:
cmd: staticcheck $(go list ./... | grep -v /vendor/)
errorformat:
- "%f:%l:%c: %m"
level: error
misspell:
cmd: misspell $(git ls-files | grep -v /vendor/))
errorformat:
- "%f:%l:%c: %m"
level: error
unparam:
cmd: unparam $(go list ./... | grep -v /vendor/)
errorformat:
- "%f:%l:%c: %m"
level: error
revive:
cmd: revive -config=.revive.toml $(go list ./... | grep -v /vendor/)
format: golint
level: error
golangci:
cmd: golangci-lint run --out-format=line-number ./...
errorformat:
- '%E%f:%l:%c: %m'
- '%E%f:%l: %m'
- '%C%.%#'
level: error

0 comments on commit 1e24c5d

Please sign in to comment.