Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'

- name: golangci-lint
uses: golangci/golangci-lint-action@v9
Expand Down
32 changes: 16 additions & 16 deletions cmd/junit2jira/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"time"
"unicode"

"github.com/carlmjohnson/versioninfo"
jira "github.com/ctreminiom/go-atlassian/v2/jira/v3"
"github.com/ctreminiom/go-atlassian/v2/pkg/infra/models"
"github.com/carlmjohnson/versioninfo"
"github.com/hashicorp/go-multierror"
"github.com/joshdk/go-junit"
"github.com/pkg/errors"
Expand Down Expand Up @@ -290,7 +290,7 @@ func (j junit2jira) linkIssues(issues []*models.IssueScheme) error {

var result error
for x, issue := range issues {
for y := 0; y < x; y++ {
for y := range x {
// Skip cases where we have the same inward and outward issue.
// Jira does not allow linking a ticket to itself.
if issue.Key == issues[y].Key {
Expand Down Expand Up @@ -535,7 +535,7 @@ func testSuiteToCSV(ts junit.Suite, p params, w *csv.Writer) error {

func (j junit2jira) mergeFailedTests(failedTests []j2jTestCase) ([]j2jTestCase, error) {
log.Warning("Too many failed tests, reporting them as a one failure.")
msg := ""
var msg strings.Builder
suite := failedTests[0].Suite
for _, t := range failedTests {
summary, err := t.summary()
Expand All @@ -546,13 +546,13 @@ func (j junit2jira) mergeFailedTests(failedTests []j2jTestCase) ([]j2jTestCase,
if suite != t.Suite {
suite = j.JobName
}
msg += summary + "\n"
msg.WriteString(summary + "\n")
}

tc := newJ2jTestCase(
testcase.NewTestCase(
junit.Test{
Message: msg,
Message: msg.String(),
Classname: suite,
}), j.params)

Expand Down Expand Up @@ -629,7 +629,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
if tc.Message != "" {
content = append(content, &models.CommentNodeScheme{
Type: "heading",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"level": 3,
},
Content: []*models.CommentNodeScheme{
Expand All @@ -638,7 +638,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
})
content = append(content, &models.CommentNodeScheme{
Type: "codeBlock",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"language": "text",
},
Content: []*models.CommentNodeScheme{
Expand All @@ -650,7 +650,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
if tc.Stderr != "" {
content = append(content, &models.CommentNodeScheme{
Type: "heading",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"level": 3,
},
Content: []*models.CommentNodeScheme{
Expand All @@ -659,7 +659,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
})
content = append(content, &models.CommentNodeScheme{
Type: "codeBlock",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"language": "text",
},
Content: []*models.CommentNodeScheme{
Expand All @@ -671,7 +671,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
if tc.Stdout != "" {
content = append(content, &models.CommentNodeScheme{
Type: "heading",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"level": 3,
},
Content: []*models.CommentNodeScheme{
Expand All @@ -680,7 +680,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
})
content = append(content, &models.CommentNodeScheme{
Type: "codeBlock",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"language": "text",
},
Content: []*models.CommentNodeScheme{
Expand All @@ -692,7 +692,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
if tc.Error != "" {
content = append(content, &models.CommentNodeScheme{
Type: "heading",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"level": 3,
},
Content: []*models.CommentNodeScheme{
Expand All @@ -701,7 +701,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
})
content = append(content, &models.CommentNodeScheme{
Type: "codeBlock",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"language": "text",
},
Content: []*models.CommentNodeScheme{
Expand All @@ -713,7 +713,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
// Add Build Information table
content = append(content, &models.CommentNodeScheme{
Type: "heading",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"level": 3,
},
Content: []*models.CommentNodeScheme{
Expand Down Expand Up @@ -755,7 +755,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
Text: tc.BuildId,
Marks: []*models.MarkScheme{{
Type: "link",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"href": tc.BuildLink,
},
}},
Expand Down Expand Up @@ -799,7 +799,7 @@ func (tc *j2jTestCase) buildADFDescription() *models.CommentNodeScheme {
Text: buildTagText,
Marks: []*models.MarkScheme{{
Type: "link",
Attrs: map[string]interface{}{
Attrs: map[string]any{
"href": tc.BaseLink,
},
}},
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/stackrox/junit2jira

go 1.24.0
go 1.26.0

require (
cloud.google.com/go/bigquery v1.73.1
Expand Down
12 changes: 6 additions & 6 deletions pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ func NewLeveled() retryablehttp.LeveledLogger {
return leveled{l: log.StandardLogger()}
}

func (l leveled) withFields(keysAndValues []interface{}) *log.Entry {
f := make(map[string]interface{})
func (l leveled) withFields(keysAndValues []any) *log.Entry {
f := make(map[string]any)

for i := 0; i < len(keysAndValues)-1; i += 2 {
f[keysAndValues[i].(string)] = keysAndValues[i+1]
Expand All @@ -23,17 +23,17 @@ func (l leveled) withFields(keysAndValues []interface{}) *log.Entry {
return l.l.WithFields(f)
}

func (l leveled) Error(msg string, keysAndValues ...interface{}) {
func (l leveled) Error(msg string, keysAndValues ...any) {
l.withFields(keysAndValues).Error(msg)
}

func (l leveled) Info(msg string, keysAndValues ...interface{}) {
func (l leveled) Info(msg string, keysAndValues ...any) {
l.withFields(keysAndValues).Info(msg)
}
func (l leveled) Debug(msg string, keysAndValues ...interface{}) {
func (l leveled) Debug(msg string, keysAndValues ...any) {
l.withFields(keysAndValues).Debug(msg)
}

func (l leveled) Warn(msg string, keysAndValues ...interface{}) {
func (l leveled) Warn(msg string, keysAndValues ...any) {
l.withFields(keysAndValues).Warn(msg)
}
Loading