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

Error 'must match format 1.23' while mock generation in docker #713

Closed
4 tasks
evsamsonov opened this issue Sep 25, 2023 · 5 comments
Closed
4 tasks

Error 'must match format 1.23' while mock generation in docker #713

evsamsonov opened this issue Sep 25, 2023 · 5 comments

Comments

@evsamsonov
Copy link
Contributor

evsamsonov commented Sep 25, 2023

Description

Error invalid go version '1.21.0': must match format 1.23 while mock generation in docker

Mockery Version

v2.34.0

Golang Version

Go 1.21

Installation Method

  • Binary Distribution
  • [ x ] Docker
  • brew
  • go install
  • Other: [specify]

Steps to Reproduce

  1. Use go version 1.21
  2. Create go mod
    go mod init test.com
  3. Create file test.go with interface
package main

type Test interface {
}
  1. Run generate mock in docker
    docker run --rm vektra/mockery --name Test --inpackage --case snake

Expected Behavior

Successful mock generation

Actual Behavior

25 Sep 23 09:04 UTC INF couldn't read any config file version=v2.34.0
25 Sep 23 09:04 UTC INF Starting mockery dry-run=false version=v2.34.0
25 Sep 23 09:04 UTC INF Using config:  dry-run=false version=v2.34.0
25 Sep 23 09:04 UTC WRN DEPRECATION: use of the packages config will be the only way to generate mocks in v3. Please migrate your config to use the packages feature. dry-run=false migration=https://vektra.github.io/mockery/v2.34/migrating_to_packages/ url=https://vektra.github.io/mockery/v2.34/features/#packages-configuration version=v2.34.0
25 Sep 23 09:04 UTC INF Walking dry-run=false version=v2.34.0
unable to find interface
25 Sep 23 09:04 UTC ERR Error parsing file error="err: exit status 1: stderr: go: errors parsing go.mod:\n/app/go.mod:3: invalid go version '1.21.1': must match format 1.23\n" dry-run=false version=v2.34.0
25 Sep 23 09:04 UTC ERR Unable to find 'Test' in any go files under this path dry-run=false version=v2.34.0
@LandonTClipp
Copy link
Collaborator

This likely isn't a mockery issue. Please double check your go.mod file features a valid go version.

https://go.dev/blog/publishing-go-modules

@evsamsonov
Copy link
Contributor Author

evsamsonov commented Sep 27, 2023

@LandonTClipp It's issue mockery in docker image. Did you try to reproduce it? go.mod have been generated by command go mod init and it is correct:

module example.com

go 1.21.1

@LandonTClipp LandonTClipp reopened this Sep 27, 2023
@LandonTClipp
Copy link
Collaborator

Apologies, you are right. It seems the Dockerfile is pulling in go 1.20 but your go.mod requires at least 1.21.1. Should be as simple as updating the Dockerfile if you want to send in a PR for that.

@LandonTClipp
Copy link
Collaborator

@evsamsonov did the new update fix your problem?

@evsamsonov
Copy link
Contributor Author

evsamsonov commented Oct 5, 2023

Yes, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants