diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1afe07e..66bfc17 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,5 +1,8 @@ name: Go Build on: [push] +permissions: + contents: read + jobs: linux: runs-on: ubuntu-latest @@ -7,7 +10,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.25 + go-version: 1.26 cache: false - name: Checkout code @@ -31,7 +34,7 @@ jobs: # - name: Set up Go # uses: actions/setup-go@v5 # with: - # go-version: 1.25 + # go-version: 1.26 # cache: false # - name: Checkout code @@ -53,7 +56,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.25 + go-version: 1.26 - name: Checkout code uses: actions/checkout@v4 diff --git a/.markdownlint.yaml b/.markdownlint.yaml index 7919da5..0c697bb 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -33,3 +33,6 @@ MD022: lines_above: 2 # Blank lines below heading lines_below: 1 + +# MD041/first-line-heading - First line does not need to be a top level heading. +MD041: false diff --git a/Makefile b/Makefile index 394a705..8ca8dfc 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ TMPDIR ?= /tmp # Setup default go-make installation flags. INSTALL_FLAGS ?= -mod=readonly -buildvcs=auto # Setup go-make version to use desired build and config scripts. -GOMAKE_DEP ?= github.com/tkrop/go-make@v0.0.166 +GOMAKE_DEP ?= github.com/tkrop/go-make@v0.2.6 # Request targets from go-make show-targets target. TARGETS := $(shell command -v $(GOBIN)/go-make >/dev/null || \ $(GO) install $(INSTALL_FLAGS) $(GOMAKE_DEP) >&2 && \ diff --git a/Makefile.ext b/Makefile.ext new file mode 100644 index 0000000..99bc8e1 --- /dev/null +++ b/Makefile.ext @@ -0,0 +1,3 @@ + +#@ updates the mock tool installing the latest version +update-mock:: install-mock diff --git a/go.mod b/go.mod index 6033ca3..4dfbd80 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/tkrop/go-testing -go 1.25.7 +go 1.26.2 require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc @@ -10,13 +10,13 @@ require ( github.com/stretchr/testify v1.11.1 go.uber.org/mock v0.6.0 golang.org/x/text v0.30.0 - golang.org/x/tools v0.41.0 + golang.org/x/tools v0.44.0 ) require ( github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect - golang.org/x/mod v0.32.0 // indirect - golang.org/x/sync v0.19.0 // indirect + golang.org/x/mod v0.35.0 // indirect + golang.org/x/sync v0.20.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index a78909c..a284fe3 100644 --- a/go.sum +++ b/go.sum @@ -28,14 +28,14 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= -golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= -golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= -golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= -golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= +golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= -golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= -golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= +golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c= +golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/internal/mock/models.go b/internal/mock/models.go index 4e91ab8..048c047 100644 --- a/internal/mock/models.go +++ b/internal/mock/models.go @@ -276,7 +276,7 @@ func NewFiles(mocks []*Mock, imports ...*Import) []*File { } } - files := []*File{} + files := make([]*File, 0, len(builders)) for _, builder := range builders { file := builder.AddImports(imports...).Build() files = append(files, file) diff --git a/internal/reflect/random.go b/internal/reflect/random.go index fffe474..8c7ae84 100644 --- a/internal/reflect/random.go +++ b/internal/reflect/random.go @@ -104,7 +104,7 @@ func (r *random) newPrimitive(kind reflect.Kind) any { case reflect.Uint64: return uint64(r.rand.Intn(2<