Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Allow AssignableToTypeOf reflect.Type #365

Merged
merged 1 commit into from
Dec 27, 2019
Merged

Allow AssignableToTypeOf reflect.Type #365

merged 1 commit into from
Dec 27, 2019

Conversation

islishude
Copy link
Contributor

use case:

package main

import (
	"context"
	"fmt"
	"reflect"

	"github.com/golang/mock/gomock"
)

func main() {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	res := gomock.AssignableToTypeOf(context.Background()).Matches(ctx)
	fmt.Println(res) // fasle, but I want true!!

	ctxType := reflect.TypeOf((*context.Context)(nil)).Elem()

	res = gomock.AssignableToTypeOf(ctxType).Matches(ctx)
	fmt.Println(res) // true

	res = gomock.AssignableToTypeOf(ctxType).Matches(context.Background())
	fmt.Println(res) // true
}

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@islishude
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@codyoss
Copy link
Member

codyoss commented Dec 20, 2019

Hey @islishude could you please open an issue for this so it can be discussed?

@codyoss
Copy link
Member

codyoss commented Dec 27, 2019

Fixes #320

@codyoss codyoss merged commit 1bf84fa into golang:master Dec 27, 2019
@codyoss
Copy link
Member

codyoss commented Dec 27, 2019

@islishude Thank you for your contribution 🎆

@islishude islishude deleted the islishude/issue-320 branch December 28, 2019 01:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants