Skip to content

Cannot regenerate fakes if they are relied upon and deleted - go1.19.10 #246

Open
@waciumawanjohi

Description

Go Version

1.19.10

Reproduction steps

# Clone an open source project using counterfeiter for testing
git clone https://github.com/vmware-tanzu/cartographer.git
cd cartographer

# Install go 1.19.10
go install golang.org/dl/go1.19.10@latest
go1.19.10 download

# Delete previously generated fakes
rm -rf pkg/repository/repositoryfakes/

# Run go generate
go1.19.10 generate ./pkg/repository

Expected result

Deleted files are recreated. Output:

Writing `FakeLogger` to `repositoryfakes/fake_logger.go`... Done
Writing `FakeRepoCache` to `repositoryfakes/fake_repo_cache.go`... Done
Writing `FakeClient` to `repositoryfakes/fake_client.go`... Done
Writing `FakeRepository` to `repositoryfakes/fake_repository.go`... Done

Observed result

Command errors. Output:

Writing `FakeLogger` to `repositoryfakes/fake_logger.go`... 
err: exit status 1: stderr: go build github.com/vmware-tanzu/cartographer/pkg/repository/repositoryfakes: cache_test.go:23:2: no required module provides package github.com/vmware-tanzu/cartographer/pkg/repository/repositoryfakes; to add it:
        go get github.com/vmware-tanzu/cartographer/pkg/repository/repositoryfakes

exit status 1
pkg/repository/repository.go:37: running "go": exit status 1

Comments

This workflow works when using go 1.19.9

You can cleanup the go downloads above by running

rm -rf $(go1.19.10 env GOROOT)
rm $(which go1.19.10)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions