File tree Expand file tree Collapse file tree 6 files changed +96
-21
lines changed Expand file tree Collapse file tree 6 files changed +96
-21
lines changed Original file line number Diff line number Diff line change
1
+ name : Run CI
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - " *"
7
+
8
+ jobs :
9
+ lint_test :
10
+ name : Linting and tests
11
+ runs-on : ubuntu-latest
12
+ permissions :
13
+ contents : write
14
+
15
+ steps :
16
+ - name : Checkout code
17
+ uses : actions/checkout@v4
18
+
19
+ - name : Set up Go
20
+ uses : actions/setup-go@v5
21
+ with :
22
+ go-version-file : " go.mod"
23
+
24
+ - name : Run linting
25
+ run : " make lint"
26
+
27
+ - name : Run tests
28
+ run : " make test"
Original file line number Diff line number Diff line change @@ -3,10 +3,11 @@ name: Release
3
3
on :
4
4
push :
5
5
tags :
6
- - " *"
6
+ - " v *"
7
7
8
8
jobs :
9
9
build_release :
10
+ name : Build logfmt binaries
10
11
runs-on : ubuntu-latest
11
12
strategy :
12
13
matrix :
30
31
GOARCH : ${{ matrix.goarch }}
31
32
run : |
32
33
go build -ldflags="-s -w" -o logfmt-${{ matrix.goos }}-${{ matrix.goarch }}-${{ github.ref_name }}
33
-
34
+
34
35
- name : Compress with UPX (Linux only)
35
36
if : matrix.goos == 'linux'
36
37
uses : crazy-max/ghaction-upx@v3
47
48
retention-days : 1
48
49
49
50
create_release :
51
+ name : Create GitHub release from tag version
50
52
runs-on : ubuntu-latest
51
53
needs : build_release
52
54
permissions :
68
70
name : " Release ${{ github.ref_name }}"
69
71
body : |
70
72
Automated release for tag ${{ github.ref_name }}.
71
- files : release-artifacts/*/*
73
+ files : release-artifacts/*/*
Original file line number Diff line number Diff line change
1
+ bin /
Original file line number Diff line number Diff line change 1
1
---
2
+ version : " 2"
2
3
linters :
3
4
enable :
4
- - goimports
5
- - stylecheck
5
+ - forbidigo
6
6
- lll
7
+ - prealloc
8
+ - predeclared
9
+ - staticcheck
7
10
- errcheck
8
-
9
- run :
10
- go : ' 1.22'
11
- timeout : 30s
12
-
13
- issues :
14
- exclude-rules :
15
- - linters :
16
- - lll
17
- source : " // nolint:lll"
18
- - linters :
19
- - unused
20
- - deadcode
21
- - varcheck
22
- source : " // nolint:unused"
11
+ exclusions :
12
+ generated : lax
13
+ presets :
14
+ - comments
15
+ - common-false-positives
16
+ - legacy
17
+ - std-error-handling
18
+ rules :
19
+ - linters :
20
+ - lll
21
+ source : // nolint:lll
22
+ - linters :
23
+ - staticcheck
24
+ source : // nolint:stylecheck
25
+ - linters :
26
+ - deadcode
27
+ - revive
28
+ - unused
29
+ - varcheck
30
+ source : // nolint:unused
31
+ - linters :
32
+ - staticcheck
33
+ text : ' SA1019:'
34
+ source : // ignore:deprecated
35
+ formatters :
36
+ enable :
37
+ - gci
38
+ - gofmt
39
+ - gofumpt
40
+ - goimports
41
+ settings :
42
+ gci :
43
+ sections :
44
+ - standard
45
+ - default
46
+ - localmodule
Original file line number Diff line number Diff line change
1
+ .PHONY : setup lint test
2
+
3
+ setup : bin/golangci-lint
4
+ go mod download
5
+
6
+ bin :
7
+ mkdir bin
8
+
9
+ bin/golangci-lint : bin
10
+ GOBIN=$(PWD ) /bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.3.0
11
+
12
+ lint : bin/golangci-lint
13
+ bin/golangci-lint fmt
14
+ go vet ./...
15
+ go mod tidy
16
+ bin/golangci-lint -c .golangci.yml run ./...
17
+
18
+ test :
19
+ go test -timeout=10s -race -cover ./...
Original file line number Diff line number Diff line change @@ -7,9 +7,10 @@ import (
7
7
"strings"
8
8
"time"
9
9
10
- "github.com/TheEdgeOfRage/logfmt/config"
11
10
"github.com/fatih/color"
12
11
"github.com/go-logfmt/logfmt"
12
+
13
+ "github.com/TheEdgeOfRage/logfmt/config"
13
14
)
14
15
15
16
var (
You can’t perform that action at this time.
0 commit comments