Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old Go versions from CI #435

Merged
merged 4 commits into from
Sep 17, 2024
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
27 changes: 3 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,6 @@ orbs:
workflows:
ci:
jobs:
- go/test:
name: test-go-1.22
gotestsum-format: testname
executor:
name: go/golang
tag: 1.18-alpine

- go/test:
name: test-go-1.21
gotestsum-format: testname
executor:
name: go/golang
tag: 1.19-alpine

- go/test:
name: test-go-1.20
gotestsum-format: testname
executor:
name: go/golang
tag: 1.20-alpine

- lint
- build

Expand Down Expand Up @@ -72,7 +51,7 @@ jobs:
default: false
executor:
name: go/golang
tag: 1.20-alpine
tag: 1.23-alpine
steps:
- go/install: {package: git}
- go/install-ssh
Expand All @@ -99,7 +78,7 @@ jobs:
lint:
executor:
name: go/golang
tag: 1.20-alpine
tag: 1.23-alpine
steps:
- checkout
- run: go mod download
Expand All @@ -109,7 +88,7 @@ jobs:
mkdir -p /go/bin

download=https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
wget -O- -q "$download" | sh -s -- -b /go/bin/ v1.51.1
wget -O- -q "$download" | sh -s -- -b /go/bin/ v1.60.3
- run:
name: Lint
command: |
Expand Down
10 changes: 2 additions & 8 deletions .project/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,33 @@ issues:
text: 'ST1000: at least one file in a package should have a package comment'
- linters: [errcheck]
text: 'Error return value of `.*\.WriteString` is not checked'
- linters: [errcheck]
text: 'Error return value of `fmt.Fprint.*` is not checked'
- linters: [unparam]
text: 'result .* is always'
- linters: [unparam]
text: 'always receives'
# Remove once go1.16 is dropped
- linters: staticcheck
text: 'env.Patch is deprecated'

linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- errcheck
- goconst
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- interfacer
- lll
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
5 changes: 2 additions & 3 deletions cmd/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"gotest.tools/gotestsum/testjson"
"gotest.tools/v3/assert"
"gotest.tools/v3/assert/cmp"
"gotest.tools/v3/env"
"gotest.tools/v3/fs"
"gotest.tools/v3/golden"
)
Expand All @@ -32,8 +31,8 @@ func TestPostRunHook(t *testing.T) {
stdout: buf,
}

env.Patch(t, "GOTESTSUM_FORMAT", "short")
env.Patch(t, "GOTESTSUM_FORMAT_ICONS", "default")
t.Setenv("GOTESTSUM_FORMAT", "short")
t.Setenv("GOTESTSUM_FORMAT_ICONS", "default")

exec := newExecFromTestData(t)
err = postRunHook(opts, exec)
Expand Down
3 changes: 1 addition & 2 deletions cmd/internal/signalhandlerdriver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"fmt"
"io/ioutil"
"os"
"os/signal"
"strconv"
Expand All @@ -17,7 +16,7 @@ func main() {
}

pid := []byte(strconv.Itoa(os.Getpid()))
if err := ioutil.WriteFile(os.Args[1], pid, 0644); err != nil {
if err := os.WriteFile(os.Args[1], pid, 0644); err != nil {
log("failed to write file:", err.Error())
os.Exit(1)
}
Expand Down
4 changes: 1 addition & 3 deletions cmd/main_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"bytes"
"io/ioutil"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -174,8 +173,7 @@ func compileBinary(t *testing.T) string {
}

binaryFixture.Do(func() string {
tmpDir, err := ioutil.TempDir("", "gotestsum-binary")
assert.NilError(t, err)
tmpDir := t.TempDir()

path := filepath.Join(tmpDir, "gotestsum")
result := icmd.RunCommand("go", "build", "-o", path, "..")
Expand Down
10 changes: 5 additions & 5 deletions cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func TestRun_RerunFails_WithTooManyInitialFailures(t *testing.T) {
{"Package": "pkg", "Action": "fail"}
`

fn := func(args []string) *proc {
fn := func([]string) *proc {
return &proc{
cmd: fakeWaiter{result: newExitCode("failed", 1)},
stdout: strings.NewReader(jsonFailed),
Expand Down Expand Up @@ -375,7 +375,7 @@ func TestRun_RerunFails_BuildErrorPreventsRerun(t *testing.T) {
{"Package": "pkg", "Action": "fail"}
`

fn := func(args []string) *proc {
fn := func([]string) *proc {
return &proc{
cmd: fakeWaiter{result: newExitCode("failed", 1)},
stdout: strings.NewReader(jsonFailed),
Expand Down Expand Up @@ -411,7 +411,7 @@ func TestRun_RerunFails_PanicPreventsRerun(t *testing.T) {
{"Package": "pkg", "Action": "fail"}
`

fn := func(args []string) *proc {
fn := func([]string) *proc {
return &proc{
cmd: fakeWaiter{result: newExitCode("failed", 1)},
stdout: strings.NewReader(jsonFailed),
Expand Down Expand Up @@ -479,7 +479,7 @@ func TestRun_JsonFileIsSyncedBeforePostRunCommand(t *testing.T) {

input := golden.Get(t, "../../testjson/testdata/input/go-test-json.out")

fn := func(args []string) *proc {
fn := func([]string) *proc {
return &proc{
cmd: fakeWaiter{},
stdout: bytes.NewReader(input),
Expand Down Expand Up @@ -515,7 +515,7 @@ func TestRun_JsonFileIsSyncedBeforePostRunCommand(t *testing.T) {
func TestRun_JsonFileTimingEvents(t *testing.T) {
input := golden.Get(t, "../../testjson/testdata/input/go-test-json.out")

fn := func(args []string) *proc {
fn := func([]string) *proc {
return &proc{
cmd: fakeWaiter{},
stdout: bytes.NewReader(input),
Expand Down
12 changes: 6 additions & 6 deletions cmd/rerunfails_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"testing"

Expand All @@ -31,7 +31,7 @@ func TestWriteRerunFailsReport(t *testing.T) {
err = writeRerunFailsReport(opts, exec)
assert.NilError(t, err)

raw, err := ioutil.ReadFile(reportFile.Path())
raw, err := os.ReadFile(reportFile.Path())
assert.NilError(t, err)
golden.Assert(t, string(raw), t.Name()+"-expected")
}
Expand All @@ -53,7 +53,7 @@ func TestWriteRerunFailsReport_HandlesMissingActionRunEvents(t *testing.T) {
err = writeRerunFailsReport(opts, exec)
assert.NilError(t, err)

raw, err := ioutil.ReadFile(reportFile.Path())
raw, err := os.ReadFile(reportFile.Path())
assert.NilError(t, err)
golden.Assert(t, string(raw), t.Name()+"-expected")
}
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestRerunFailed_ReturnsAnErrorWhenTheLastTestIsSuccessful(t *testing.T) {
},
}

fn := func(args []string) *proc {
fn := func([]string) *proc {
next := events[0]
events = events[1:]
return &proc{
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestRerunFailed_ReturnsAnErrorWhenTheLastTestIsSuccessful(t *testing.T) {

func patchStartGoTestFn(f func(args []string) *proc) func() {
orig := startGoTestFn
startGoTestFn = func(ctx context.Context, dir string, args []string) (*proc, error) {
startGoTestFn = func(_ context.Context, _ string, args []string) (*proc, error) {
return f(args), nil
}
return func() {
Expand Down Expand Up @@ -190,7 +190,7 @@ func (e exitCodeError) ExitCode() int {
}

func newExitCode(msg string, code int) error {
return exitCodeError{error: fmt.Errorf(msg), code: code}
return exitCodeError{error: fmt.Errorf("%v", msg), code: code}
}

type noopHandler struct{}
Expand Down
6 changes: 3 additions & 3 deletions cmd/testdata/e2e/flaky/flaky_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//go:build testdata
// +build testdata

package flaky

import (
"fmt"
"io/ioutil"
"os"
"strconv"
"sync"
Expand All @@ -17,7 +17,7 @@ var once = new(sync.Once)

func setup(t *testing.T) {
once.Do(func() {
raw, err := ioutil.ReadFile(seedfile)
raw, err := os.ReadFile(seedfile)
if err != nil {
t.Fatalf("failed to read seed: %v", err)
}
Expand All @@ -27,7 +27,7 @@ func setup(t *testing.T) {
}
seed = int(n)

err = ioutil.WriteFile(seedfile, []byte(strconv.Itoa(seed+1)), 0644)
err = os.WriteFile(seedfile, []byte(strconv.Itoa(seed+1)), 0644)
if err != nil {
t.Fatalf("failed to write seed: %v", err)
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/tool/slowest/slowest.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package slowest
import (
"fmt"
"io"
"io/ioutil"
"os"
"time"

Expand Down Expand Up @@ -139,7 +138,7 @@ func run(opts *options) error {
func jsonfileReader(v string) (io.ReadCloser, error) {
switch v {
case "", "-":
return ioutil.NopCloser(os.Stdin), nil
return io.NopCloser(os.Stdin), nil
default:
return os.Open(v)
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bufio"
"context"
"fmt"
"io/ioutil"
"os"
"os/exec"

Expand Down Expand Up @@ -97,7 +96,7 @@ func runSingle(opts *options, dir string) (*testjson.Execution, error) {
}

func delveInitFile(exec *testjson.Execution) (string, func(), error) {
fh, err := ioutil.TempFile("", "gotestsum-delve-init")
fh, err := os.CreateTemp("", "gotestsum-delve-init")
if err != nil {
return "", nil, err
}
Expand Down
11 changes: 9 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
module gotest.tools/gotestsum

go 1.21

require (
github.com/bitfield/gotestdox v0.2.2
github.com/dnephin/pflag v1.0.7
github.com/fatih/color v1.17.0
github.com/fsnotify/fsnotify v1.7.0
github.com/google/go-cmp v0.6.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
golang.org/x/sync v0.7.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.25.0
golang.org/x/term v0.24.0
golang.org/x/tools v0.19.0
gotest.tools/v3 v3.5.1
)

go 1.13
require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/text v0.11.0 // indirect
)
Loading