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
19 changes: 10 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.19
uses: actions/setup-go@v3
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.19.2
go-version: 1.23.4
id: go

- name: Set path
Expand Down Expand Up @@ -44,14 +44,14 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.19
uses: actions/setup-go@v3
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.19.2
go-version: 1.23.4
id: go

- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: build
id: build
Expand All @@ -69,8 +69,9 @@ jobs:
GOPATH: ${{runner.workspace}}

- name: Upload binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rtf-binaries
name: ${{steps.build.outputs.binary}}
path: ${{steps.build.outputs.binary}}
overwrite: true

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ifndef INEFFASSIGN
endif
@echo "+ $@: golangci-lint, gofmt, go vet, ineffassign"
# golangci-lint
@test -z "$$(golangci-lint run ./... | tee /dev/stderr)"
golangci-lint run ./...
# gofmt
@test -z "$$(gofmt -s -l .| grep -v .pb. | grep -v vendor/ | tee /dev/stderr)"
ifeq ($(GOOS),)
Expand All @@ -62,7 +62,7 @@ endif

.PHONY: install-deps
install-deps:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2
go install github.com/gordonklaus/ineffassign@latest

.PHONY: test
Expand Down
13 changes: 6 additions & 7 deletions cmd/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"encoding/csv"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strings"
"text/tabwriter"
Expand Down Expand Up @@ -55,13 +54,13 @@ func compare(_ *cobra.Command, args []string) error {

var summaries []local.Summary
for _, fileName := range args {
data, err := ioutil.ReadFile(fileName)
data, err := os.ReadFile(fileName)
if err != nil {
return err
}
var s local.Summary
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("Failed to unmarshal %s: %v", fileName, err)
return fmt.Errorf("failed to unmarshal %s: %v", fileName, err)
}
summaries = append(summaries, s)
}
Expand All @@ -74,7 +73,7 @@ func compare(_ *cobra.Command, args []string) error {
heading := []string{"Name"}
if !csvCompare {
heading = append(heading, args...)
fmt.Fprintln(tw, strings.Join(heading, "\t"))
_, _ = fmt.Fprintln(tw, strings.Join(heading, "\t"))
} else {
ids := []string{"ID"}
starts := []string{"Start Time"}
Expand All @@ -101,7 +100,7 @@ func compare(_ *cobra.Command, args []string) error {
for j := range summaries {
r := summaries[j].Results[i]
if r.Name != name {
return fmt.Errorf("List of results for %s don't match %s: %s != %s", args[0], args[j], r.Name, name)
return fmt.Errorf("list of results for %s don't match %s: %s != %s", args[0], args[j], r.Name, name)
}

resStr := r.TestResult.Sprintf("%s (%s)",
Expand All @@ -112,14 +111,14 @@ func compare(_ *cobra.Command, args []string) error {
results = append(results, resStr)
}
if !csvCompare {
fmt.Fprintln(tw, strings.Join(results, "\t"))
_, _ = fmt.Fprintln(tw, strings.Join(results, "\t"))
} else {
if err := cw.Write(results); err != nil {
return err
}
}
}
tw.Flush()
_ = tw.Flush()
cw.Flush()
return nil
}
6 changes: 3 additions & 3 deletions cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func info(_ *cobra.Command, _ []string) error {

lst := p.List(config)
if !csvInfo {
fmt.Fprintf(tw, "NAME\tDESCRIPTION\n")
_, _ = fmt.Fprintf(tw, "NAME\tDESCRIPTION\n")
} else {
heading := []string{"Name", "Description", "Known issues"}
if err := cw.Write(heading); err != nil {
Expand All @@ -64,15 +64,15 @@ func info(_ *cobra.Command, _ []string) error {

for _, i := range lst {
if !csvInfo {
fmt.Fprintf(tw, "%s\t%s\n", i.Name, i.Summary)
_, _ = fmt.Fprintf(tw, "%s\t%s\n", i.Name, i.Summary)
} else {
out := []string{i.Name, i.Summary, i.Issue}
if err := cw.Write(out); err != nil {
return nil
}
}
}
tw.Flush()
_ = tw.Flush()
cw.Flush()
return nil
}
6 changes: 3 additions & 3 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ func list(_ *cobra.Command, args []string) error {
w.Init(os.Stdout, 0, 8, 0, '\t', 0)

lst := p.List(config)
fmt.Fprint(w, "STATE\tTEST\tLABELS\n")
_, _ = fmt.Fprint(w, "STATE\tTEST\tLABELS\n")
for _, i := range lst {
state := i.TestResult.Sprintf(local.TestResultNames[i.TestResult])
fmt.Fprintf(w, "%s\t%s\t%s\n", state, i.Name, i.LabelString())
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\n", state, i.Name, i.LabelString())
}
w.Flush()
_ = w.Flush()
return nil
}
6 changes: 3 additions & 3 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func run(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
defer tf.Close()
defer func() { _ = tf.Close() }()

tCsv := csv.NewWriter(tf)
if err = tCsv.Write(testCsvFields); err != nil {
Expand All @@ -159,7 +159,7 @@ func run(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
defer sf.Close()
defer func() { _ = sf.Close() }()

sCsv := csv.NewWriter(sf)

Expand Down Expand Up @@ -288,7 +288,7 @@ func run(cmd *cobra.Command, args []string) error {
log.Log(logger.LevelSummary, fmt.Sprintf("Duration: %.2fs", duration.Seconds()))

if failed > 0 {
return fmt.Errorf("Some tests failed")
return fmt.Errorf("some tests failed")
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion local/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func NewRunConfig(labels string, pattern string) RunConfig {
// ValidatePattern validates that an arg string is a valid test pattern
func ValidatePattern(args []string) (string, error) {
if len(args) > 1 {
return "", fmt.Errorf("Expected only one test pattern")
return "", fmt.Errorf("expected only one test pattern")
}
if len(args) == 0 {
return "", nil
Expand Down
4 changes: 2 additions & 2 deletions local/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func ParseTags(file string) (*Tags, error) {
if err != nil {
return nil, err
}
defer f.Close()
defer func() { _ = f.Close() }()

tags := &Tags{}
scanner := bufio.NewScanner(f)
Expand Down Expand Up @@ -80,7 +80,7 @@ func ParseTags(file string) (*Tags, error) {
}
} else {
if v.String() != "" {
return nil, fmt.Errorf("Field %s specified multiple times", rt)
return nil, fmt.Errorf("field %s specified multiple times", rt)
}
v.SetString(tagValue)
}
Expand Down
2 changes: 1 addition & 1 deletion local/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestParseBadTags(t *testing.T) {
if err == nil {
t.Fatalf("Should have caused an error")
}
if err.Error() != "Field LABELS specified multiple times" {
if err.Error() != "field LABELS specified multiple times" {
t.Fatalf("Wrong error message")
}
}
2 changes: 1 addition & 1 deletion local/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func executeScript(script, cwd, name string, args []string, config RunConfig) (R
}
}
if executable == "" {
return Result{}, fmt.Errorf("Can't find a suitable shell to execute %s", script)
return Result{}, fmt.Errorf("can't find a suitable shell to execute %s", script)
}
cmdArgs = append(cmdArgs, script)
cmdArgs = append(cmdArgs, args...)
Expand Down
6 changes: 3 additions & 3 deletions local/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (t *Test) Init() error {
t.Summary = tags.Summary
order, name := getNameAndOrder(filepath.Base(t.Path))
if t.Parent == nil {
return fmt.Errorf("A test should have a parent group")
return fmt.Errorf("a test should have a parent group")
}
t.Tags.Name = fmt.Sprintf("%s.%s", t.Parent.Name(), name)
t.Labels, t.NotLabels = ParseLabels(t.Tags.Labels)
Expand Down Expand Up @@ -129,7 +129,7 @@ func (t *Test) Run(config RunConfig) ([]Result, error) {
if t.Parent.PreTestPath != "" {
res, err := executeScript(t.Parent.PreTestPath, t.Path, name, []string{name}, config)
if res.TestResult != Pass {
return results, fmt.Errorf("Error running: %s. %s", t.Parent.PreTestPath, err.Error())
return results, fmt.Errorf("error running: %s. %s", t.Parent.PreTestPath, err.Error())
}
}
// Run the test
Expand All @@ -156,7 +156,7 @@ func (t *Test) Run(config RunConfig) ([]Result, error) {
if t.Parent.PostTestPath != "" {
res, err := executeScript(t.Parent.PostTestPath, t.Path, name, []string{name, fmt.Sprintf("%d", res.TestResult)}, config)
if res.TestResult != Pass {
return results, fmt.Errorf("Error running: %s. %s", t.Parent.PostTestPath, err.Error())
return results, fmt.Errorf("error running: %s. %s", t.Parent.PostTestPath, err.Error())
}
}
res.Test = t
Expand Down
2 changes: 1 addition & 1 deletion logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func TestFileLogger(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer f.Close()
defer func() { _ = f.Close() }()

l := NewFileLogger(f)
l.SetLevel(LevelDebug)
Expand Down
2 changes: 1 addition & 1 deletion sysinfo/sysinfo_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func getPlatformSpecifics(info SystemInfo) SystemInfo {
v := strings.TrimSpace(fs[1])

if k == "MemTotal" {
v = strings.Replace(v, " kB", "", -1)
v = strings.ReplaceAll(v, " kB", "")
n, _ := strconv.ParseInt(v, 10, 64)
info.Memory = n * 1024
break
Expand Down
Loading