Skip to content

Commit 9d10cd8

Browse files
authored
Merge pull request #293 from lucassabreu/chore/update-workflows
feat: update workflows versions
2 parents 24eb680 + 4d58baa commit 9d10cd8

17 files changed

Lines changed: 60 additions & 37 deletions

File tree

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
tags:
55
- v*
66
branches:
7-
- master
87
- main
98
pull_request:
109
permissions:
@@ -16,12 +15,11 @@ jobs:
1615
name: lint
1716
runs-on: ubuntu-latest
1817
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/setup-go@v5
18+
- uses: actions/checkout@v6
19+
- uses: actions/setup-go@v6
2120
with:
2221
go-version: 1.24
23-
cache: false
2422
- name: golangci-lint
25-
uses: golangci/golangci-lint-action@v7
23+
uses: golangci/golangci-lint-action@v9
2624
with:
2725
version: latest

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: checkout
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v6
1515
- name: go-setup
16-
uses: actions/setup-go@v5
16+
uses: actions/setup-go@v6
1717
with:
1818
go-version: 1.24
1919
- name: install snapcraft
20-
uses: samuelmeuli/action-snapcraft@v4
20+
uses: samuelmeuli/action-snapcraft@v3
2121
- name: install nix
2222
uses: cachix/install-nix-action@v31
2323
- name: goreleaser-setup

.github/workflows/test-unit.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ name: Unit Tests
22
on:
33
pull_request:
44
push:
5+
tags:
6+
- v*
7+
branches:
8+
- main
59
jobs:
610
tests:
711
runs-on: ubuntu-latest
812

913
steps:
1014
- name: Check out code into the Go module directory
11-
uses: actions/checkout@v4
15+
uses: actions/checkout@v6
1216

13-
- uses: actions/setup-go@v5
17+
- uses: actions/setup-go@v6
1418
with:
1519
go-version: 1.24
1620

@@ -30,11 +34,11 @@ jobs:
3034
uses: codecov/codecov-action@v5
3135
with:
3236
token: ${{ secrets.CODECOV_TOKEN }}
33-
file: ./coverage.txt
37+
files: ./coverage.txt
3438
flags: unittests
3539

3640
- name: Report test coverage to DeepSource
37-
uses: deepsourcelabs/test-coverage-action@v1
41+
uses: deepsourcelabs/test-coverage-action@master
3842
with:
3943
key: go
4044
coverage-file: ./coverage.txt

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
- updated github workflows to use the newest versions of the actions
1717
- removed unused code
18+
- fixed assorted lint errors
19+
20+
### Thanks
21+
22+
Thank you to [@reva](https://github.com/reva) for the improvements on
23+
[#292](https://github.com/lucassabreu/clockify-cli/pull/292).
1824

1925
## [v0.62.0] - 2026-03-20
2026

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ deps-upgrade: ## upgrade go dependencies
1515
go get -u -v $(MAIN_PKG)
1616
go mod tidy
1717

18-
build: dist
18+
build: clean dist
1919

2020
dist: deps-install dist/darwin dist/linux dist/windows ## build all cli versions (default)
2121

api/httpClient.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,19 @@ func (c *client) NewRequest(method, uri string, body interface{}) (*http.Request
7676

7777
// Do executes a http.Request inside the Clockify's Client
7878
func (c *client) Do(
79-
req *http.Request, v interface{}, name string) (*http.Response, error) {
79+
req *http.Request, v interface{}, name string) (r *http.Response, err error) {
8080

8181
<-c.requestTickets
8282

83-
r, err := c.Client.Do(req)
83+
r, err = c.Client.Do(req)
8484
if err != nil {
8585
return r, err
8686
}
87-
defer r.Body.Close()
87+
defer func() {
88+
if e := r.Body.Close(); e != nil {
89+
err = e
90+
}
91+
}()
8892

8993
buf := new(bytes.Buffer)
9094

cmd/clockify-cli/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@ func execute() int {
5858

5959
stderr := cmd.ErrOrStderr()
6060
if errors.Is(err, terminal.InterruptErr) {
61-
fmt.Fprintln(stderr)
61+
_, _ = fmt.Fprintln(stderr)
6262
return exitCancel
6363
}
6464

6565
var flagError *cmdutil.FlagError
6666
if errors.As(err, &flagError) {
67-
fmt.Fprintln(stderr, flagError.Error())
68-
fmt.Fprintln(stderr, cmd.UsageString())
67+
_, _ = fmt.Fprintln(stderr, flagError.Error())
68+
_, _ = fmt.Fprintln(stderr, cmd.UsageString())
6969
return exitError
7070
}
7171

7272
if f.Config().IsDebuging() {
73-
fmt.Fprintf(stderr, "%+v\n", err)
73+
_, _ = fmt.Fprintf(stderr, "%+v\n", err)
7474
} else {
75-
fmt.Fprintln(stderr, err.Error())
75+
_, _ = fmt.Fprintln(stderr, err.Error())
7676
}
7777

7878
return exitError

internal/consoletest/test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func RunTestConsole(
8989
if err != nil {
9090
t.Fatalf("failed to create console: %v", err)
9191
}
92-
defer c.Close()
92+
defer func() { _ = c.Close() }()
9393

9494
finished := false
9595
t.Cleanup(func() {
@@ -109,7 +109,7 @@ func RunTestConsole(
109109
}()
110110

111111
go func() {
112-
defer c.Tty().Close()
112+
defer func() { _ = c.Tty().Close() }()
113113
if err = setup(c.Tty(), c.Tty()); err != nil {
114114
t.Error(err)
115115
return

pkg/cmd/client/add/add.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/lucassabreu/clockify-cli/api/dto"
99
"github.com/lucassabreu/clockify-cli/pkg/cmd/client/util"
1010
"github.com/lucassabreu/clockify-cli/pkg/cmdutil"
11-
"github.com/lucassabreu/clockify-cli/pkg/output/client"
1211
"github.com/spf13/cobra"
1312
)
1413

@@ -66,10 +65,6 @@ func NewCmdAdd(
6665
return report(out, &of, cl)
6766
}
6867

69-
if of.JSON {
70-
client.ClientJSONPrint(cl, out)
71-
}
72-
7368
return util.Report([]dto.Client{cl}, out, of)
7469
},
7570
}

pkg/cmd/version/version.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ func NewCmdVersion(f cmdutil.Factory) *cobra.Command {
1212
return &cobra.Command{
1313
Use: "version",
1414
Short: "Shows the CLI version",
15-
Run: func(cmd *cobra.Command, _ []string) {
15+
RunE: func(cmd *cobra.Command, _ []string) error {
1616
v := f.Version()
17-
fmt.Fprintln(cmd.OutOrStdout(),
17+
_, err := fmt.Fprintln(cmd.OutOrStdout(),
1818
"Version: "+v.Tag+", Commit: "+v.Commit+", Build At: "+v.Date,
1919
)
20+
21+
return err
2022
},
2123
}
2224
}

0 commit comments

Comments
 (0)