Skip to content

Commit c875f5a

Browse files
Upgrade Go to 1.25.3 and refresh dependencies
- Bump Go version in CI, Makefile, and go.mod - Replace deprecated ioutil and strings.Title usages - Update GitHub Actions and all module dependencies Signed-off-by: Jai Pradeesh <jai@deepsource.io>
1 parent 901650d commit c875f5a

File tree

15 files changed

+277
-550
lines changed

15 files changed

+277
-550
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ jobs:
1414

1515
steps:
1616
- name: Set up Go 1.x
17-
uses: actions/setup-go@v2
17+
uses: actions/setup-go@v6
1818
with:
19-
go-version: ^1.18
19+
go-version: '1.25.5'
2020

2121
- name: Check out code into the Go module directory
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v6
2323
with:
2424
fetch-depth: 1
2525
ref: ${{ github.event.pull_request.head.sha }}

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v6
1717
with:
1818
fetch-depth: 0
1919
submodules: 'true'
2020

2121
- name: Set up Go
22-
uses: actions/setup-go@v4
22+
uses: actions/setup-go@v6
2323
with:
24-
go-version: 1.21
24+
go-version: '1.25.5'
2525

2626
- name: Setup environment variables
2727
run: |-

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PACKAGE_NAME := github.com/deepsourcelabs/cli
2-
GOLANG_CROSS_VERSION ?= v1.21.6
2+
GOLANG_CROSS_VERSION ?= v1.25.3
33

44
SYSROOT_DIR ?= sysroots
55
SYSROOT_ARCHIVE ?= sysroots.tar.bz2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Usage:
5151
deepsource <command> [<arguments>]
5252
5353
Available commands are:
54-
report Report an artifact to an analyzer
54+
auth Authenticate with DeepSource
5555
config Generate and Validate DeepSource config
5656
help Help about any command
5757
issues Show the list of issues in a file in a repository

command/config/validate/validate.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"os/exec"
109
"path/filepath"
@@ -60,9 +59,9 @@ func (o *Options) Run() error {
6059
}
6160

6261
// Read the config in the form of string and send it
63-
content, err := ioutil.ReadFile(configPath)
62+
content, err := os.ReadFile(configPath)
6463
if err != nil {
65-
return errors.New("Error occured while reading DeepSource config file. Exiting...")
64+
return fmt.Errorf("error occured while reading DeepSource config file %s: %w", configPath, err)
6665
}
6766

6867
// Fetch the client

command/issues/list/list.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"encoding/csv"
66
"encoding/json"
77
"fmt"
8-
"io/ioutil"
98
"os"
109

1110
"github.com/MakeNowJust/heredoc"
@@ -237,7 +236,7 @@ func (opts *IssuesListOptions) exportJSON(filename string) (err error) {
237236
return nil
238237
}
239238

240-
if err = ioutil.WriteFile(filename, data, 0o644); err != nil {
239+
if err = os.WriteFile(filename, data, 0o644); err != nil {
241240
return err
242241
}
243242

command/issues/list/list_test.go

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package list
22

33
import (
44
"encoding/json"
5-
"io/ioutil"
65
"os"
76
"reflect"
87
"strings"
@@ -13,9 +12,14 @@ import (
1312

1413
// Helper function to read issues from a file.
1514
func ReadIssues(path string) []issues.Issue {
16-
raw, _ := ioutil.ReadFile(path)
15+
raw, err := os.ReadFile(path)
16+
if err != nil {
17+
panic(err)
18+
}
1719
var fetchedIssues []issues.Issue
18-
_ = json.Unmarshal(raw, &fetchedIssues)
20+
if err := json.Unmarshal(raw, &fetchedIssues); err != nil {
21+
panic(err)
22+
}
1923

2024
return fetchedIssues
2125
}
@@ -26,8 +30,14 @@ func TestListCSV(t *testing.T) {
2630
opts.exportCSV("./testdata/exported.csv")
2731

2832
// read exported and test CSV files
29-
exported, _ := ioutil.ReadFile("./testdata/exported.csv")
30-
test, _ := ioutil.ReadFile("./testdata/csv/test.csv")
33+
exported, err := os.ReadFile("./testdata/exported.csv")
34+
if err != nil {
35+
t.Fatal(err)
36+
}
37+
test, err := os.ReadFile("./testdata/csv/test.csv")
38+
if err != nil {
39+
t.Fatal(err)
40+
}
3141

3242
// trim carriage returns
3343
got := strings.TrimSuffix(string(exported), "\n")
@@ -47,8 +57,14 @@ func TestListJSON(t *testing.T) {
4757
opts.exportJSON("./testdata/exported.json")
4858

4959
// read exported and test JSON files
50-
exported, _ := ioutil.ReadFile("./testdata/exported.json")
51-
test, _ := ioutil.ReadFile("./testdata/json/test.json")
60+
exported, err := os.ReadFile("./testdata/exported.json")
61+
if err != nil {
62+
t.Fatal(err)
63+
}
64+
test, err := os.ReadFile("./testdata/json/test.json")
65+
if err != nil {
66+
t.Fatal(err)
67+
}
5268

5369
// trim carriage returns
5470
got := strings.TrimSuffix(string(exported), "\n")
@@ -60,6 +76,7 @@ func TestListJSON(t *testing.T) {
6076
if !reflect.DeepEqual(got, want) {
6177
t.Errorf("got: %v; want: %v\n", got, want)
6278
}
79+
}
6380
}
6481

6582
func TestListSARIF(t *testing.T) {
@@ -71,8 +88,8 @@ func TestListSARIF(t *testing.T) {
7188
opts.exportSARIF("./testdata/exported.sarif")
7289

7390
// read exported and test SARIF files
74-
exported, _ := ioutil.ReadFile("./testdata/exported.sarif")
75-
test, _ := ioutil.ReadFile("./testdata/sarif/test.sarif")
91+
exported, _ := os.ReadFile("./testdata/exported.sarif")
92+
test, _ := os.ReadFile("./testdata/sarif/test.sarif")
7693

7794
// trim carriage returns
7895
got := strings.TrimSuffix(string(exported), "\n")
@@ -94,8 +111,8 @@ func TestListSARIF(t *testing.T) {
94111
opts.exportSARIF("./testdata/exported_multi.sarif")
95112

96113
// read exported and test SARIF files
97-
exported, _ := ioutil.ReadFile("./testdata/exported_multi.sarif")
98-
test, _ := ioutil.ReadFile("./testdata/sarif/test_multi.sarif")
114+
exported, _ := os.ReadFile("./testdata/exported_multi.sarif")
115+
test, _ := os.ReadFile("./testdata/sarif/test_multi.sarif")
99116

100117
// trim carriage returns
101118
got := strings.TrimSuffix(string(exported), "\n")

command/issues/list/testdata/sarif/test.sarif

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"version": "2.1.0",
3-
"$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json",
3+
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json",
44
"runs": [
55
{
66
"tool": {
77
"driver": {
8-
"informationUri": "https://deepsource.io/directory/analyzers/go",
8+
"informationUri": "https://deepsource.com/directory/analyzers/go",
99
"name": "DeepSource Go Analyzer",
1010
"rules": [
1111
{
@@ -15,7 +15,7 @@
1515
"fullDescription": {
1616
"text": ""
1717
},
18-
"helpUri": "https://deepsource.io/directory/analyzers/go/issues/RVV-B0013",
18+
"helpUri": "https://deepsource.com/directory/analyzers/go/issues/RVV-B0013",
1919
"properties": {
2020
"category": "",
2121
"recommended": ""

command/issues/list/testdata/sarif/test_multi.sarif

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"version": "2.1.0",
3-
"$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json",
3+
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json",
44
"runs": [
55
{
66
"tool": {
77
"driver": {
8-
"informationUri": "https://deepsource.io/directory/analyzers/go",
8+
"informationUri": "https://deepsource.com/directory/analyzers/go",
99
"name": "DeepSource Go Analyzer",
1010
"rules": [
1111
{
@@ -15,7 +15,7 @@
1515
"fullDescription": {
1616
"text": ""
1717
},
18-
"helpUri": "https://deepsource.io/directory/analyzers/go/issues/RVV-B0013",
18+
"helpUri": "https://deepsource.com/directory/analyzers/go/issues/RVV-B0013",
1919
"properties": {
2020
"category": "",
2121
"recommended": ""
@@ -74,7 +74,7 @@
7474
{
7575
"tool": {
7676
"driver": {
77-
"informationUri": "https://deepsource.io/directory/analyzers/docker",
77+
"informationUri": "https://deepsource.com/directory/analyzers/docker",
7878
"name": "DeepSource Docker Analyzer",
7979
"rules": [
8080
{
@@ -84,7 +84,7 @@
8484
"fullDescription": {
8585
"text": ""
8686
},
87-
"helpUri": "https://deepsource.io/directory/analyzers/docker/issues/DOK-DL3025",
87+
"helpUri": "https://deepsource.com/directory/analyzers/docker/issues/DOK-DL3025",
8888
"properties": {
8989
"category": "",
9090
"recommended": ""
@@ -121,7 +121,7 @@
121121
{
122122
"tool": {
123123
"driver": {
124-
"informationUri": "https://deepsource.io/directory/analyzers/python",
124+
"informationUri": "https://deepsource.com/directory/analyzers/python",
125125
"name": "DeepSource Python Analyzer",
126126
"rules": [
127127
{
@@ -131,7 +131,7 @@
131131
"fullDescription": {
132132
"text": ""
133133
},
134-
"helpUri": "https://deepsource.io/directory/analyzers/python/issues/PY-W2000",
134+
"helpUri": "https://deepsource.com/directory/analyzers/python/issues/PY-W2000",
135135
"properties": {
136136
"category": "",
137137
"recommended": ""

command/issues/list/utils.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88

99
"github.com/deepsourcelabs/cli/deepsource/issues"
1010
"github.com/owenrumney/go-sarif/v2/sarif"
11+
"golang.org/x/text/cases"
12+
"golang.org/x/text/language"
1113
)
1214

1315
type ExportData struct {
@@ -164,10 +166,11 @@ func convertSARIF(issueData []issues.Issue) *sarif.Report {
164166
count := 0
165167

166168
// Adding the tools data to the SARIF report corresponding to the number of analyzers activated
169+
caser := cases.Title(language.English)
167170
for _, issue := range issueData {
168171
if !shortcodes[issue.Analyzer.Shortcode].exists {
169-
driverName := "DeepSource " + strings.Title(issue.Analyzer.Shortcode) + " Analyzer"
170-
informationURI := "https://deepsource.io/directory/analyzers/" + string(issue.Analyzer.Shortcode)
172+
driverName := "DeepSource " + caser.String(issue.Analyzer.Shortcode) + " Analyzer"
173+
informationURI := "https://deepsource.com/directory/" + string(issue.Analyzer.Shortcode)
171174

172175
tool := sarif.Tool{
173176
Driver: &sarif.ToolComponent{
@@ -206,7 +209,7 @@ func convertSARIF(issueData []issues.Issue) *sarif.Report {
206209
pb.Add("category", "")
207210
pb.Add("recommended", "")
208211

209-
helpURI := "https://deepsource.io/directory/analyzers/" + string(issue.Analyzer.Shortcode) + "/issues/" + string(issue.IssueCode)
212+
helpURI := "https://deepsource.com/directory/" + string(issue.Analyzer.Shortcode) + "/issues/" + string(issue.IssueCode)
210213

211214
// add rule
212215
runs[idx].AddRule(issue.IssueCode).WithName(issue.IssueText).WithFullDescription(&fullDescription).WithHelpURI(helpURI).WithProperties(pb.Properties)

0 commit comments

Comments
 (0)