bugreport

package
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

README

Embedded Interfaces in aux_files

Embedded interfaces in aux_files generate unknown embedded interface XXX errors. See below for example of the problem:

// source
import (
    alias "some.org/package/imported"
)

type Source interface {
    alias.Foreign
}
// some.org/package/imported
type Foreign interface {
    Embedded
}

type Embedded interface {}

Attempting to generate a mock will result in an unknown embedded interface Embedded. The issue is that the fileParser stores auxInterfaces underneath the package name explicitly specified in the aux_files flag.

In the parseInterface method, there is an incorrect assumption about an embedded interface always being in the source file.

case *ast.Ident:
        // Embedded interface in this package.
        ei := p.auxInterfaces[""][v.String()]
        if ei == nil {
                return nil, p.errorf(v.Pos(), "unknown embedded interface %s", v.String())
        }

Documentation

Overview

Package bugreport is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallForeignMethod

func CallForeignMethod(s Source)

Types

type MockSource

type MockSource struct {
	// contains filtered or unexported fields
}

MockSource is a mock of Source interface

func NewMockSource

func NewMockSource(ctrl *gomock.Controller) *MockSource

NewMockSource creates a new mock instance

func (*MockSource) EXPECT

func (m *MockSource) EXPECT() *MockSourceMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockSource) Method

func (m *MockSource) Method() faux.Return

Method mocks base method

type MockSourceMockRecorder

type MockSourceMockRecorder struct {
	// contains filtered or unexported fields
}

MockSourceMockRecorder is the mock recorder for MockSource

func (*MockSourceMockRecorder) Method

func (mr *MockSourceMockRecorder) Method() *gomock.Call

Method indicates an expected call of Method

type Source

type Source interface {
	faux.Foreign
}

Source is an interface w/ an embedded foreign interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL