Skip to content

Commit

Permalink
Merge pull request #26 from lestrrat-go/topic/housecleaning
Browse files Browse the repository at this point in the history
House cleaning
  • Loading branch information
lestrrat authored Jan 6, 2021
2 parents cf82b46 + a0cf85d commit a505ebc
Show file tree
Hide file tree
Showing 18 changed files with 304 additions and 218 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.15', '1.14' ]
name: Go ${{ matrix.go }} test
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Go stable version
if: matrix.go != 'tip'
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Install Go tip
if: matrix.go == 'tip'
run: |
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
cd $HOME/gotip/src
./make.bash
echo "::set-env name=GOROOT::$HOME/gotip"
echo "::add-path::$HOME/gotip/bin"
echo "::add-path::$(go env GOPATH)/bin"
- name: Test
run: go test -v -race ./...
- name: Upload code coverage to codecov
if: matrix.go == '1.15'
uses: codecov/codecov-action@v1
with:
file: ./coverage.out

11 changes: 11 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: lint
on: [push, pull_request]
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: golangci/golangci-lint-action@v2
with:
version: v1.34.1
56 changes: 56 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
run:
skip-dirs: internal

linters-settings:
govet:
enable-all: true
disable:
- shadow

linters:
enable-all: true
disable:
- dupl
- exhaustive
- exhaustivestruct
- errorlint
- funlen
- gci
- gochecknoglobals
- gochecknoinits
- gocognit
- gocritic
- gocyclo
- godot
- godox
- goerr113
- gofumpt
- gomnd
- gosec
- lll
- makezero
- nakedret
- nestif
- nlreturn
- paralleltest
- testpackage
- thelper
- unconvert
- wrapcheck
- wsl

issues:
exclude-rules:
- path: /*_test.go
linters:
- errcheck
- path: /*_example_test.go
linters:
- forbidigo

# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

File renamed without changes.
18 changes: 18 additions & 0 deletions bench/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module github.com/lestrrat-go/fluent-client/bench

go 1.16

require (
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/fluent/fluent-logger-golang v1.5.0
github.com/k0kubun/fluent-logger-go v0.0.0-20201119054120-59ff43471d04
github.com/kr/pretty v0.2.1 // indirect
github.com/lestrrat-go/backoff v1.0.1 // indirect
github.com/lestrrat-go/fluent-client v0.0.0-20180220234652-cf82b4654aab
github.com/lestrrat-go/msgpack v0.0.0-20191118094803-f1541f70f50e // indirect
github.com/lestrrat-go/pdebug v0.0.0-20200204225717-4d6bd78da58d // indirect
github.com/tinylib/msgp v1.1.5 // indirect
github.com/ugorji/go v1.2.2 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/vmihailenco/msgpack.v2 v2.9.1 // indirect
)
22 changes: 11 additions & 11 deletions buffered.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func NewBuffered(options ...Option) (client *Buffered, err error) {

var subsecond bool
for _, opt := range options {
switch opt.Name() {
case optkeySubSecond:
switch opt.Ident() {
case identSubSecond{}:
subsecond = opt.Value().(bool)
}
}
Expand Down Expand Up @@ -91,14 +91,14 @@ func (c *Buffered) Post(tag string, v interface{}, options ...Option) (err error
var t time.Time
var ctx = context.Background()
for _, opt := range options {
switch opt.Name() {
case optkeyTimestamp:
switch opt.Ident() {
case identTimestamp{}:
t = opt.Value().(time.Time)
case optkeySyncAppend:
case identSyncAppend{}:
syncAppend = opt.Value().(bool)
case optkeySubSecond:
case identSubSecond{}:
subsecond = opt.Value().(bool)
case optkeyContext:
case identContext{}:
if pdebug.Enabled {
pdebug.Printf("client: using user-supplied context")
}
Expand Down Expand Up @@ -221,12 +221,12 @@ func (c *Buffered) Ping(tag string, record interface{}, options ...Option) (err
var subsecond bool
var t time.Time
for _, opt := range options {
switch opt.Name() {
case optkeySubSecond:
switch opt.Ident() {
case identSubSecond{}:
subsecond = opt.Value().(bool)
case optkeyTimestamp:
case identTimestamp{}:
t = opt.Value().(time.Time)
case optkeyContext:
case identContext{}:
if pdebug.Enabled {
pdebug.Printf("client: using user-supplied context")
}
Expand Down
2 changes: 0 additions & 2 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ func IsBufferFull(e error) bool {
if cerr, ok := e.(causer); ok {
e = cerr.Cause()
}

e = nil
}
return false
}
Expand Down
4 changes: 2 additions & 2 deletions fluent.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ package fluent
func New(options ...Option) (Client, error) {
var buffered = true
for _, opt := range options {
switch opt.Name() {
case optkeyBuffered:
switch opt.Ident() {
case identBuffered{}:
buffered = opt.Value().(bool)
}
}
Expand Down
Loading

0 comments on commit a505ebc

Please sign in to comment.