Skip to content

Commit bdf3a32

Browse files
authored
chores: maintenance (#90)
* chores: maintenance - updated release pipeline - fixed lints (suppresed) - `make` removed - readme re-arranged and changed * fix: updated job name * fix: error lint
1 parent 00040b7 commit bdf3a32

10 files changed

Lines changed: 83 additions & 213 deletions

File tree

.editorconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ trim_trailing_whitespace = true # no extra sapces at the end of lines
1616
indent_style = tab
1717
indent_size = 2
1818

19-
[{Makefile,makefile}] # CMake
20-
indent_style = tab
21-
2219
[*.md] # Markdown
2320
trim_trailing_whitespace = true
2421
max_line_length = 100

.github/workflows/main.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ jobs:
2525
with:
2626
go-version: ${{ matrix.go }}
2727

28-
- run: make build
29-
- run: make tests
28+
# --- 🚀 Dev Pipiline -----------------------------------------------------------------------
29+
- uses: go-task/setup-task@v2
30+
- run: task build
31+
- run: task tests
3032

3133
- name: Install goveralls
3234
if: matrix.go == 'stable'
@@ -38,7 +40,7 @@ jobs:
3840
COVERALLS_TOKEN: ${{ secrets.github_token }}
3941
run: goveralls -coverprofile=coverage.cov -service=github
4042

41-
GolangCILinter:
43+
Linter:
4244
runs-on: ubuntu-latest
4345
steps:
4446
- uses: actions/checkout@v6

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
with:
2424
args: release --clean
2525
env:
26-
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 0 additions & 132 deletions
This file was deleted.

Taskfile.yml

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3'
1+
version: "3"
22

33
tasks:
44
default: task --list-all
@@ -7,67 +7,81 @@ tasks:
77
watcher:
88
desc: watcher
99
sources:
10-
- ./**/*.go
10+
- ./**/*.go
1111
method: timestamp
1212
cmds:
13-
- task: lints
14-
- task: test-summary
15-
- task: build-race
13+
- task: lints
14+
- task: test-summary
15+
- task: build-race
1616

1717
# Generating assets ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1818
generate:
1919
desc: Generate Assets
2020
sources:
21-
- ./checkers_*.go
22-
- ./cmd/internal/**/*.go
21+
- ./checkers_*.go
22+
- ./cmd/internal/**/*.go
2323
method: timestamp
2424
cmds:
25-
- task generate-mirror-table
26-
- task generate-tests
25+
- task generate-mirror-table
26+
- task generate-tests
2727

2828
generate-mirror-table:
2929
desc: Generates Assets at testdata
30-
cmd: make generate-mirror-table
30+
cmd: go run ./cmd/internal/mirror-table/ > ./MIRROR_FUNCS.md
3131

3232
generate-tests:
3333
desc: Generate Asset MIRROR_FUNCS.md
34-
cmd: make generate-tests
34+
cmd: go run ./cmd/internal/tests/ ./testdata
3535

3636
# Run Tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3737
tests:
3838
desc: Run Tests
39-
cmd: make tests
39+
cmd: |
40+
go test -v -count=1 -race \
41+
-failfast \
42+
-parallel=2 \
43+
-timeout=1m \
44+
-covermode=atomic \
45+
-coverpkg $(go list ./... | grep -v -E "cmd" | tr "\n" ",") \
46+
-coverprofile=coverage.cov ./...
47+
4048
ignore_error: true
4149

4250
test-summary:
4351
desc: Run Tests (Summary)
44-
cmd: make tests-summary
52+
cmd: |
53+
go test -v -count=1 -race \
54+
-failfast \
55+
-parallel=2 \
56+
-timeout=1m \
57+
-covermode=atomic \
58+
-coverpkg $(go list ./... | grep -v -E "cmd" | tr "\n" ",") \
59+
-coverprofile=coverage.cov --json ./... | tparse -all
4560
ignore_error: true
4661

4762
testcase: go test -v -failfast -count=1 -run "TestAll/{{ .Case }}" ./...
4863

4964
# Build Artifacts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5065
build:
5166
desc: Build binary
52-
cmd: make build
67+
cmd: go build -trimpath -ldflags="-w -s" -o bin/mirror ./cmd/mirror/
5368

5469
build-race:
5570
desc: Build binary with race flag
56-
cmd: make build-race
71+
cmd: go build -race -trimpath -ldflags="-w -s" -o bin/mirror ./cmd/mirror/
5772

5873
install:
5974
desc: Install binary
60-
cmd: make install
75+
cmd: go install -trimpath -v -ldflags="-w -s" ./cmd/mirror
6176

6277
# Linter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63-
lints:
64-
cmd: make lints
78+
lints: golangci-lint run --no-config ./...
6579

6680
# Other
6781
cover:
6882
desc: Run Coverage
69-
cmd: make cover
83+
cmd: go tool cover -html=coverage.cov
7084

7185
test-release:
7286
desc: Testing Release
73-
cmd: make test-release
87+
cmd: goreleaser release --snapshot --clean

cmd/internal/tests/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ func GenerateTestFile(file string, pkgName string, Tests []string) error {
106106
if err != nil {
107107
return err
108108
}
109-
defer f.Close()
109+
defer func() { _ = f.Close() }()
110110

111111
w := bufio.NewWriter(f)
112-
defer w.Flush()
112+
defer func() { _ = w.Flush() }()
113113

114114
return templates.ExecuteTemplate(w, "file.tmpl", struct {
115115
Package string

cmd/internal/tests/support.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,6 @@ func variate(variance string, oneIsString bool) []string {
3131
for i := 0; i < len(variance); i++ {
3232
var input string
3333

34-
// if out argument is in string we gonna take argument that is
35-
if oneIsString {
36-
input = `"foobar"`
37-
} else {
38-
input = `[]byte{'f','o','o','b','a','r'}`
39-
}
40-
41-
if oneIsString && (variance[i] == '1') {
42-
input = fmt.Sprintf(`%s(%s)`, "[]byte", input)
43-
}
44-
if !oneIsString && (variance[i] == '0') {
45-
input = fmt.Sprintf(`%s(%s)`, "string", input)
46-
}
47-
4834
if oneIsString {
4935
// looking for string
5036
if variance[i] == '1' {

internal/checker/checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func WrapType(info *types.Info) func(node ast.Expr) string {
141141
func WrapPrint(fSet *token.FileSet) func(ast.Node) []byte {
142142
return func(node ast.Node) []byte {
143143
var buf bytes.Buffer
144-
printer.Fprint(&buf, fSet, node)
144+
_ = printer.Fprint(&buf, fSet, node)
145145
return buf.Bytes()
146146
}
147147
}

internal/checker/violation.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ func (v *Violation) suggest(fSet *token.FileSet) []byte {
104104
buf.WriteByte('(')
105105
for idx := range v.callExpr.Args {
106106
if arg, ok := v.arguments[idx]; ok {
107-
printer.Fprint(&buf, fSet, arg)
107+
_ = printer.Fprint(&buf, fSet, arg)
108108
} else {
109-
printer.Fprint(&buf, fSet, v.callExpr.Args[idx])
109+
_ = printer.Fprint(&buf, fSet, v.callExpr.Args[idx])
110110
}
111111

112112
if idx != len(v.callExpr.Args)-1 {
@@ -126,7 +126,7 @@ func (v *Violation) Diagnostic(fSet *token.FileSet) analysis.Diagnostic {
126126
}
127127

128128
var buf bytes.Buffer
129-
printer.Fprint(&buf, fSet, v.callExpr)
129+
_ = printer.Fprint(&buf, fSet, v.callExpr)
130130
noNl := bytes.IndexByte(buf.Bytes(), '\n') < 0
131131

132132
// Struct based fix.
@@ -177,7 +177,7 @@ func (v *Violation) Issue(fSet *token.FileSet) GolangIssue {
177177

178178
// original expression (useful for debug & required for replace)
179179
var buf bytes.Buffer
180-
printer.Fprint(&buf, fSet, v.callExpr)
180+
_ = printer.Fprint(&buf, fSet, v.callExpr)
181181
issue.Original = buf.String()
182182

183183
noNl := strings.IndexByte(issue.Original, '\n') < 0

0 commit comments

Comments
 (0)