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

refactor go:generate lines so they are consistently placed #527

Merged
merged 1 commit into from Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions gomock/matchers_test.go
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate mockgen -destination internal/mock_gomock/mock_matcher.go github.com/golang/mock/gomock Matcher

package gomock_test

//go:generate mockgen -destination internal/mock_gomock/mock_matcher.go github.com/golang/mock/gomock Matcher

import (
"context"
"errors"
Expand Down
@@ -1,7 +1,7 @@
//go:generate mockgen -aux_files faux=faux/faux.go -destination bugreport_mock.go -package bugreport -source=bugreport.go Example

package bugreport

//go:generate mockgen -aux_files faux=faux/faux.go -destination bugreport_mock.go -package bugreport -source=bugreport.go Example

import (
"log"

Expand Down
4 changes: 2 additions & 2 deletions mockgen/internal/tests/copyright_file/input.go
@@ -1,5 +1,5 @@
//go:generate mockgen -package empty_interface -destination mock.go -source input.go -copyright_file=mock_copyright_header

package empty_interface

//go:generate mockgen -package empty_interface -destination mock.go -source input.go -copyright_file=mock_copyright_header

type Empty interface{}
4 changes: 2 additions & 2 deletions mockgen/internal/tests/custom_package_name/greeter/greeter.go
@@ -1,7 +1,7 @@
//go:generate mockgen -source greeter.go -destination greeter_mock_test.go -package greeter

package greeter

//go:generate mockgen -source greeter.go -destination greeter_mock_test.go -package greeter

import (
// stdlib import
"fmt"
Expand Down
3 changes: 2 additions & 1 deletion mockgen/internal/tests/dot_imports/input.go
@@ -1,6 +1,7 @@
//go:generate mockgen -package dot_imports -destination mock.go -source input.go
package dot_imports

//go:generate mockgen -package dot_imports -destination mock.go -source input.go

import (
"bytes"
. "context"
Expand Down
3 changes: 2 additions & 1 deletion mockgen/internal/tests/empty_interface/input.go
@@ -1,4 +1,5 @@
//go:generate mockgen -package empty_interface -destination mock.go -source input.go
package empty_interface

//go:generate mockgen -package empty_interface -destination mock.go -source input.go

type Empty interface{}
@@ -1,7 +1,7 @@
//go:generate mockgen -destination bugreport_mock.go -package bugreport -source=bugreport.go

package bugreport

//go:generate mockgen -destination bugreport_mock.go -package bugreport -source=bugreport.go

type Example interface {
// _m and _mr were used by the buggy code: the '_' prefix was there hoping
// that no one will use method argument names starting with '_' reducing
Expand Down
4 changes: 2 additions & 2 deletions mockgen/internal/tests/import_embedded_interface/bugreport.go
Expand Up @@ -11,11 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//go:generate mockgen -destination bugreport_mock.go -package bugreport -source=bugreport.go

package bugreport

//go:generate mockgen -destination bugreport_mock.go -package bugreport -source=bugreport.go

import (
"log"

Expand Down
5 changes: 3 additions & 2 deletions mockgen/internal/tests/import_embedded_interface/net.go
Expand Up @@ -10,10 +10,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//go:generate mockgen -destination net_mock.go -package bugreport -source=net.go

package bugreport

//go:generate mockgen -destination net_mock.go -package bugreport -source=net.go

import "net/http"

type Net interface {
Expand Down
3 changes: 2 additions & 1 deletion mockgen/internal/tests/import_source/definition/source.go
@@ -1,6 +1,7 @@
package source

//go:generate mockgen -destination ../source_mock.go -source=source.go
//go:generate mockgen -package source -destination source_mock.go -source=source.go
package source

type X struct{}

Expand Down
3 changes: 2 additions & 1 deletion mockgen/internal/tests/internal_pkg/generate.go
@@ -1,3 +1,4 @@
package test

//go:generate mockgen -destination subdir/internal/pkg/reflect_output/mock.go github.com/golang/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg Intf
//go:generate mockgen -source subdir/internal/pkg/input.go -destination subdir/internal/pkg/source_output/mock.go
package test
4 changes: 2 additions & 2 deletions mockgen/internal/tests/missing_import/source/source.go
@@ -1,8 +1,8 @@
//go:generate mockgen -package source -destination=../output/source_mock.go -source=source.go

// Package source makes sure output imports its. See #505.
package source

//go:generate mockgen -package source -destination=../output/source_mock.go -source=source.go

type Foo struct{}

type Bar interface {
Expand Down
1 change: 1 addition & 0 deletions mockgen/internal/tests/overlapping_methods/overlap.go
Expand Up @@ -3,6 +3,7 @@
package overlap

//go:generate mockgen -package overlap -destination mock.go -source overlap.go -aux_files github.com/golang/mock/mockgen/internal/tests/overlapping_methods=interfaces.go

type ReadWriteCloser interface {
ReadCloser
WriteCloser
Expand Down
3 changes: 2 additions & 1 deletion mockgen/internal/tests/self_package/types.go
@@ -1,6 +1,7 @@
//go:generate mockgen -package core -self_package github.com/golang/mock/mockgen/internal/tests/self_package -destination mock.go github.com/golang/mock/mockgen/internal/tests/self_package Methods
package core

//go:generate mockgen -package core -self_package github.com/golang/mock/mockgen/internal/tests/self_package -destination mock.go github.com/golang/mock/mockgen/internal/tests/self_package Methods

type Info struct {
name string
}
Expand Down
4 changes: 2 additions & 2 deletions mockgen/internal/tests/unexported_method/bugreport.go
@@ -1,7 +1,7 @@
//go:generate mockgen -destination bugreport_mock.go -package bugreport -source=bugreport.go Example

package bugreport

//go:generate mockgen -destination bugreport_mock.go -package bugreport -source=bugreport.go Example

import "fmt"

// Example is an interface with a non exported method
Expand Down
4 changes: 2 additions & 2 deletions sample/concurrent/concurrent.go
@@ -1,8 +1,8 @@
//go:generate mockgen -destination mock/concurrent_mock.go github.com/golang/mock/sample/concurrent Math

// Package concurrent demonstrates how to use gomock with goroutines.
package concurrent

//go:generate mockgen -destination mock/concurrent_mock.go github.com/golang/mock/sample/concurrent Math

type Math interface {
Sum(a, b int) int
}
6 changes: 3 additions & 3 deletions sample/user.go
@@ -1,8 +1,8 @@
//go:generate mockgen -destination mock_user/mock_user.go github.com/golang/mock/sample Index,Embed,Embedded

// An example package with an interface.
// Package user is an example package with an interface.
package user

//go:generate mockgen -destination mock_user/mock_user.go github.com/golang/mock/sample Index,Embed,Embedded

// Random bunch of imports to test mockgen.
import "io"
import (
Expand Down