Migrate to Go modules

This commit is contained in:
Suhas Karanth 2020-08-16 10:43:25 +05:30 committed by Suhas Karanth
parent af008c214b
commit 1163963381
25 changed files with 95 additions and 16 deletions

1
.gitignore vendored
View File

@ -24,3 +24,4 @@ _testmain.go
*.prof
.vscode
.idea
.playground

8
go.mod Normal file
View File

@ -0,0 +1,8 @@
module github.com/matryer/moq
go 1.14
require (
github.com/pmezard/go-difflib v1.0.0
golang.org/x/tools v0.0.0-20200815165600-90abf76919f3
)

24
go.sum Normal file
View File

@ -0,0 +1,24 @@
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200815165600-90abf76919f3 h1:0aScV/0rLmANzEYIhjCOi2pTvDyhZNduBUMD2q3iqs4=
golang.org/x/tools v0.0.0-20200815165600-90abf76919f3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@ -393,7 +393,7 @@ func TestVendoredPackages(t *testing.T) {
s := buf.String()
// assertions of things that should be mentioned
var strs = []string{
`"github.com/matryer/somerepo"`,
`"github.com/sudo-suhas/moq-test-pkgs/somerepo"`,
}
for _, str := range strs {
if !strings.Contains(s, str) {
@ -404,7 +404,7 @@ func TestVendoredPackages(t *testing.T) {
func TestVendoredInterface(t *testing.T) {
m, err := New(Config{
SrcDir: "testpackages/vendoring/vendor/github.com/matryer/somerepo",
SrcDir: "testpackages/vendoring/vendor/github.com/sudo-suhas/moq-test-pkgs/somerepo",
PkgName: "someother",
})
if err != nil {
@ -418,14 +418,14 @@ func TestVendoredInterface(t *testing.T) {
s := buf.String()
// assertions of things that should be mentioned
var strs = []string{
`"github.com/matryer/somerepo"`,
`"github.com/sudo-suhas/moq-test-pkgs/somerepo"`,
}
for _, str := range strs {
if !strings.Contains(s, str) {
t.Errorf("expected but missing: \"%s\"", str)
}
}
incorrectImport := `"github.com/matryer/moq/pkg/moq/testpackages/vendoring/vendor/github.com/matryer/somerepo"`
incorrectImport := `"github.com/matryer/moq/pkg/moq/testpackages/vendoring/vendor/github.com/sudo-suhas/moq-test-pkgs/somerepo"`
if strings.Contains(s, incorrectImport) {
t.Errorf("unexpected import: %s", incorrectImport)
}
@ -444,7 +444,7 @@ func TestVendoredBuildConstraints(t *testing.T) {
s := buf.String()
// assertions of things that should be mentioned
var strs = []string{
`"github.com/matryer/buildconstraints"`,
`"github.com/sudo-suhas/moq-test-pkgs/buildconstraints"`,
}
for _, str := range strs {
if !strings.Contains(s, str) {

View File

@ -0,0 +1,5 @@
module github.com/matryer/moq/pkg/moq/testpackages/buildconstraints
go 1.14
require github.com/sudo-suhas/moq-test-pkgs/buildconstraints v0.0.0-20200816045313-d2f573eea6c7

View File

@ -0,0 +1,3 @@
github.com/sudo-suhas/moq-test-pkgs v0.0.0-20200816045313-d2f573eea6c7 h1:Nrz0lKzL7rEBWiclll8DLmBAuPZxMdJTe3UHzPOUkgg=
github.com/sudo-suhas/moq-test-pkgs/buildconstraints v0.0.0-20200816045313-d2f573eea6c7 h1:/GmPJhGa5xWMHHdGZ7K5MNM6prYeSnlSUeExdNg62bk=
github.com/sudo-suhas/moq-test-pkgs/buildconstraints v0.0.0-20200816045313-d2f573eea6c7/go.mod h1:3SKj4JbVOiJQrGo/HyVTyp+jKwC8eIIDtOaK4L5RZNE=

View File

@ -1,9 +1,8 @@
package user
import "github.com/matryer/buildconstraints"
import "github.com/sudo-suhas/moq-test-pkgs/buildconstraints"
// Service does something good with computers.
type Service interface {
DoSomething(buildconstraints.SomeType) error
}

View File

@ -0,0 +1,3 @@
module github.com/sudo-suhas/moq-test-pkgs/buildconstraints
go 1.14

View File

@ -9,4 +9,3 @@ type SomeType struct {
// Truth indicates whether true is true or not. Computers.
Truth bool
}

View File

@ -0,0 +1,3 @@
# github.com/sudo-suhas/moq-test-pkgs/buildconstraints v0.0.0-20200816045313-d2f573eea6c7
## explicit
github.com/sudo-suhas/moq-test-pkgs/buildconstraints

View File

@ -0,0 +1,5 @@
module github.com/matryer/moq/pkg/moq/testpackages
go 1.14
require github.com/sudo-suhas/moq-test-pkgs/somerepo v0.0.0-20200816045313-d2f573eea6c7

View File

@ -0,0 +1,2 @@
github.com/sudo-suhas/moq-test-pkgs/somerepo v0.0.0-20200816045313-d2f573eea6c7 h1:5TDSgxW5A9Homgu8Kh0iB1aeRCgM1y8pZaxAR0TjeQs=
github.com/sudo-suhas/moq-test-pkgs/somerepo v0.0.0-20200816045313-d2f573eea6c7/go.mod h1:3CK3+2qBd+EkNJP+dgGjVYIbEwRQWVf6EgcmyIjTi2A=

View File

@ -1,6 +1,6 @@
package user
import "github.com/matryer/somerepo"
import "github.com/sudo-suhas/moq-test-pkgs/somerepo"
//go:generate moq -out user_moq_test.go . Service

View File

@ -4,7 +4,7 @@
package user
import (
"github.com/matryer/somerepo"
"github.com/sudo-suhas/moq-test-pkgs/somerepo"
"sync"
)

View File

@ -0,0 +1,3 @@
module github.com/sudo-suhas/moq-test-pkgs/somerepo
go 1.14

View File

@ -0,0 +1,3 @@
# github.com/sudo-suhas/moq-test-pkgs/somerepo v0.0.0-20200816045313-d2f573eea6c7
## explicit
github.com/sudo-suhas/moq-test-pkgs/somerepo

View File

@ -0,0 +1,5 @@
module github.com/matryer/moq/pkg/moq/testpackages/vendoring
go 1.14
require github.com/sudo-suhas/moq-test-pkgs/somerepo v0.0.0-20200816045313-d2f573eea6c7

View File

@ -0,0 +1,2 @@
github.com/sudo-suhas/moq-test-pkgs/somerepo v0.0.0-20200816045313-d2f573eea6c7 h1:5TDSgxW5A9Homgu8Kh0iB1aeRCgM1y8pZaxAR0TjeQs=
github.com/sudo-suhas/moq-test-pkgs/somerepo v0.0.0-20200816045313-d2f573eea6c7/go.mod h1:3CK3+2qBd+EkNJP+dgGjVYIbEwRQWVf6EgcmyIjTi2A=

View File

@ -1,6 +1,6 @@
package user
import "github.com/matryer/somerepo"
import "github.com/sudo-suhas/moq-test-pkgs/somerepo"
// Service does something good with computers.
type Service interface {

View File

@ -0,0 +1,13 @@
// Package somerepo is a vendored package to test how moq deals with
// packages in the vendor package.
package somerepo
// SomeType is just some old type.
type SomeType struct {
// Truth indicates whether true is true or not. Computers.
Truth bool
}
type SomeService interface {
Get() SomeType
}

View File

@ -0,0 +1,3 @@
module github.com/sudo-suhas/moq-test-pkgs/somerepo
go 1.14

View File

@ -0,0 +1,3 @@
# github.com/sudo-suhas/moq-test-pkgs/somerepo v0.0.0-20200816045313-d2f573eea6c7
## explicit
github.com/sudo-suhas/moq-test-pkgs/somerepo

View File

@ -1,4 +0,0 @@
package somerepo
// SomeType is some type
type SomeType string