oNaiPs / go-generate-fast

Enhanced version of go generate
MIT License
30 stars 1 forks source link

When env is passed to go:generate plugin is not getting recognized #22

Open balakumarsubramani opened 3 weeks ago

balakumarsubramani commented 3 weeks ago

Declare a genrate with env

//go:generate env GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn mockgen -package=mocks -destination=../../mocks/custom_provider_mock.go authserver/session CustomProvider
type CustomProvider interface {
    session.Provider
    GetExpireDate(string) (string, error)
    GetDecoded(string, LoggerInterface) (map[string]interface{}, error)
    CreateNewSession(string, LoggerInterface) (sessionstore.SessionStore, error)
}

Notice the generated code is not cached

session/session_provider.go: env GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn mockgen -package=mocks -destination=../../mocks/custom_provider_mock.go authserver/session CustomProvider (generated, noplugin, 9198ms)

Generated code is cached when env is not passed to go:generate