Skip to content

Commit

Permalink
Merge pull request #509 from bdandy/internal_fix
Browse files Browse the repository at this point in the history
Add replace for internal path
  • Loading branch information
LandonTClipp authored Feb 3, 2023
2 parents 3882a4c + aa1f0ff commit 8641a5b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/outputter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"

"github.com/rs/zerolog"

"github.com/vektra/mockery/v2/pkg/config"
"github.com/vektra/mockery/v2/pkg/logging"
)
Expand Down Expand Up @@ -56,6 +57,10 @@ func (p *FileOutputStreamProvider) GetWriter(ctx context.Context, iface *Interfa
relativePath := strings.TrimPrefix(
filepath.Join(filepath.Dir(iface.FileName), p.filename(caseName)),
absOriginalDir)

// as it's not possible to import from internal path, we have to replace it in mocks when KepTree is used
relativePath = strings.Replace(relativePath, "/internal/", "/internal_/", -1)

path = filepath.Join(p.BaseDir, relativePath)
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
return nil, err, func() error { return nil }
Expand Down

0 comments on commit 8641a5b

Please sign in to comment.