vektra / mockery

A mock code autogenerator for Go
https://vektra.github.io/mockery/
BSD 3-Clause "New" or "Revised" License
5.8k stars 395 forks source link

Could not run the latest Mockery Docker image with 1.22 codebase #756

Closed daweifeng closed 4 months ago

daweifeng commented 4 months ago

Description

Although the Dockerfile is using golang:1.22-alpine, the go version in go.mod is still 1.21, which causing this error when running Mockery on my 1.22 codebase:

ERR encountered error when loading package error="-: This application uses version go1.21 of the source-processing packages but runs version go1.22 of 'go list'. It may fail to process source files that rely on newer language features. If so, rebuild the application using a newer version of Go." dry-run=false version=v2.40.3

Mockery Version

v2.40.3

Golang Version

1.22

Installation Method

Steps to Reproduce

  1. Create a go codebase with 1.22 and use the latest feature, like for i := range 10
  2. Run Mockery on the codebase

Expected Behavior

There shouldn't have errors like the ones above.

Actual Behavior

ERR encountered error when loading package error="-: This application uses version go1.21 of the source-processing packages but runs version go1.22 of 'go list'. It may fail to process source files that rely on newer language features. If so, rebuild the application using a newer version of Go." dry-run=false version=v2.40.3
LandonTClipp commented 4 months ago

Ah of course, I will fix it.