Skip to content

How to install the go-mockgen binary ? #29

@nathani-work

Description

@nathani-work

Hello,

I'm using go-mockgen in one of my projects, where I have it run in a bash script.
I see in the README that the installation instructions are:

go get -u github.com/derision-test/go-mockgen/...

but as that's the old way of installing tools, go complains, and asks me to use go install instead.

So my bash script includes:

go install github.com/derision-test/go-mockgen/...
go generate ./...

When I run by bash script though, I get this output:

../../../../go/pkg/mod/github.com/derision-test/go-mockgen@v1.2.0/cmd/go-mockgen/args.go:11:2: missing go.sum entry for module providing package github.com/alecthomas/kingpin (imported by github.com/derision-test/go-mockgen/cmd/go-mockgen);
 to add:                                                                                                                                                                                                                                        
        go get github.com/derision-test/go-mockgen/cmd/go-mockgen@v1.2.0                                                                                                                                                                        
../../../../go/pkg/mod/github.com/derision-test/go-mockgen@v1.2.0/internal/mockgen/generation/generate.go:13:2: missing go.sum entry for module providing package github.com/dave/jennifer/jen (imported by github.com/derision-test/go-mockgen/
internal/mockgen/generation); to add:                                                                                                                                                                                                           
        go get github.com/derision-test/go-mockgen/internal/mockgen/generation@v1.2.0                                                                                                                                                           
../../../../go/pkg/mod/github.com/derision-test/go-mockgen@v1.2.0/internal/mockgen/generation/generate_structs.go:9:2: missing go.sum entry for module providing package github.com/dustin/go-humanize (imported by github.com/derision-test/go-
mockgen/internal/mockgen/generation); to add:                                                                                                                                                                                                   
        go get github.com/derision-test/go-mockgen/internal/mockgen/generation@v1.2.0                                                                                                                                                           
../../../../go/pkg/mod/github.com/derision-test/go-mockgen@v1.2.0/internal/mockgen/generation/generate_comment.go:8:2: missing go.sum entry for module providing package github.com/mitchellh/go-wordwrap (imported by github.com/derision-test/
go-mockgen/internal/mockgen/generation); to add:                                                                                                                                                                                                
        go get github.com/derision-test/go-mockgen/internal/mockgen/generation@v1.2.0                                                                                                                                                           
../../../../go/pkg/mod/github.com/derision-test/go-mockgen@v1.2.0/internal/mockgen/types/extract.go:13:2: missing go.sum entry for module providing package golang.org/x/tools/go/packages (imported by github.com/derision-test/go-mockgen/inte
rnal/mockgen/types); to add:                                                                                                                                                                                                                    
        go get github.com/derision-test/go-mockgen/internal/mockgen/types@v1.2.0                                                                                                                                                                
../../../../go/pkg/mod/github.com/derision-test/go-mockgen@v1.2.0/testutil/gomega/anything_matcher.go:6:2: missing go.sum entry for module providing package github.com/onsi/gomega/format (imported by github.com/derision-test/go-mockgen/test
util/gomega); to add:                                                                                                                                                                                                                           
        go get github.com/derision-test/go-mockgen/testutil/gomega@v1.2.0                                                                                                                                                                       
../../../../go/pkg/mod/github.com/derision-test/go-mockgen@v1.2.0/testutil/gomega/called_with_matcher.go:8:2: missing go.sum entry for module providing package github.com/onsi/gomega/matchers (imported by github.com/derision-test/go-mockgen
/testutil/gomega); to add:                                                                                                                                                                                                                      
        go get github.com/derision-test/go-mockgen/testutil/gomega@v1.2.0                                                                                                                                                                       
../../../../go/pkg/mod/github.com/derision-test/go-mockgen@v1.2.0/testutil/gomega/anything_matcher.go:7:2: missing go.sum entry for module providing package github.com/onsi/gomega/types (imported by github.com/derision-test/go-mockgen/testu
til/gomega); to add:                                                                                                                                                                                                                            
        go get github.com/derision-test/go-mockgen/testutil/gomega@v1.2.0

These missing entries are not actually missing entries, as I don't want them in my go project. go-mockgen is a tool I want to run on the project, but I don't necessarily want to add it as dependencies for my project.

Moreover, if I do run all the go get commands that are listed, whenever I will run go mod tidy, they will be removed, as they are not actually dependencies in my code.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions