gomock Questions

6

Solved

I'm new to go. Currently I'm using zsh terminal in macOS, just followed the instructions pointed out here https://github.com/golang/mock when installing go mock. However when trying to execute a mo...
Mirellamirelle asked 30/5, 2022 at 5:21

3

I have a Printer interface that uses the standard go Printf function signature: type Printer interface { Printf(format string, tokens ...interface{}) } I would like to be able to mock this inte...
Denning asked 24/2, 2016 at 20:32

2

I've been most recently experimenting with GoMock, the test mocking framework supported by the official creators of the Go language. I was wondering where is the most reasonable place to put these ...
Thylacine asked 19/2, 2017 at 21:46

3

Solved

We are working with Go modules. I want in a CLI to get the specific version of a module. Is it possible? If you are curious, the reason is that I want to add the following generate command: //go:ge...
Af asked 5/12, 2019 at 13:26

3

Let's say we have a library provide a function Double to double the integer, we use pointer i to get the result value not by return: package api type Action interface { Double(i *int) error } t...
Rabaul asked 18/12, 2019 at 3:42

3

For sentence resp, err := client.Get(fmt.Sprintf("https://www.xxxxx/day?time=%s", time)) If I want to mock a response to this client.Get() in unit test, I should use httptest.server, but how can...
Verney asked 26/10, 2017 at 0:37

1

There are a few test cases I want to run for which there is a need to start a GRPC mock server. I am using gomock library for this. To start the server, I have to pass a variable of type testing.T ...
Glinys asked 3/11, 2018 at 7:23

1

I have a package collision where I get the following error: mockgen -package=mocks -source=myproto.pb.go -destination=mocks/my_mocks.go imported package collision: "foo" imported twice I see one...
Diesel asked 22/5, 2018 at 21:52

1

Solved

I am using Gomock https://godoc.org/github.com/golang/mock and mockgen The Source code for this test is: package sqs import ( "fmt" "log" "os" "runtime" "github.com/aws/aws-sdk-go/aws/sess...
Baleen asked 6/7, 2018 at 8:49

1

Solved

I want to test a function, which does not return any value, but instead triggers other functions. While reading about testing, I found information that this is called a behavioral verification and ...
Zigzag asked 3/1, 2018 at 18:8

1

I am using gomock to create mock objects for unit testing. The following gives the mock object a method called GetQuestionById and tells the mock controller to expect the method to be called with a...
Exaggerated asked 26/10, 2013 at 4:53
1

© 2022 - 2024 — McMap. All rights reserved.