-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow adding headers to generated fakes
When the `-header` flag is specified and is a valid file path, the content of that file will be prepended to the generated fake. This is useful for e.g. specify a licence header. The header flag can be specified in the `go:generate` and the `counterfeiter:generate` line or in both, where the later takes precedence over the former.
- Loading branch information
1 parent
a447b66
commit 9f0dd8a
Showing
25 changed files
with
843 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// This is a default header for all the fakes in this package | ||
// | ||
|
40 changes: 40 additions & 0 deletions
40
fixtures/headers/defaultheader/defaultheaderfakes/fake_header_default.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
fixtures/headers/defaultheader/defaultheaderfakes/fake_header_specific.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package defaultheader // import "github.com/maxbrunsfeld/counterfeiter/v6/fixtures/headers/defaultheader" | ||
|
||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -header ../default.header.go.txt -generate | ||
|
||
//counterfeiter:generate . HeaderDefault | ||
type HeaderDefault interface{} | ||
|
||
//counterfeiter:generate -header ../specific.header.go.txt . HeaderSpecific | ||
type HeaderSpecific interface{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package nodefaultheader // import "github.com/maxbrunsfeld/counterfeiter/v6/fixtures/headers/nodefaultheader" | ||
|
||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate | ||
|
||
//counterfeiter:generate . HeaderDefault | ||
type HeaderDefault interface{} | ||
|
||
//counterfeiter:generate -header ../specific.header.go.txt . HeaderSpecific | ||
type HeaderSpecific interface{} |
37 changes: 37 additions & 0 deletions
37
fixtures/headers/nodefaultheader/nodefaultheaderfakes/fake_header_default.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
fixtures/headers/nodefaultheader/nodefaultheaderfakes/fake_header_specific.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// This is a specific header for only some of the fakes in this package | ||
// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.