-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deprecated reflect mode has been replaced with package mode #207
Changes from 17 commits
3075423
2b8cc4c
0643be9
703a35f
02bca6a
07d869b
2cb45fb
6ac4347
c630751
c5cd86f
08f7db9
5b309e7
6fc5cf5
69210e9
cbd7843
b14e7ad
dcf893d
3d7cfd3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"log" | ||
"os" | ||
) | ||
|
||
const ( | ||
deprecatedFlagProgOnly = "prog_only" | ||
deprecatedFlagExecOnly = "exec_only" | ||
) | ||
|
||
var ( | ||
_ = flag.Bool("prog_only", false, "DEPRECATED (reflect mode) Only generate the reflection program; write it to stdout and exit.") | ||
_ = flag.String("exec_only", "", "DEPRECATED (reflect mode) If set, execute this reflection program.") | ||
) | ||
|
||
// notifyAboutDeprecatedFlags prints a warning message for a deprecated flags if they are set. | ||
func notifyAboutDeprecatedFlags() { | ||
const resetColorPostfix = "\033[0m" | ||
logger := initWarningLogger() | ||
|
||
flag.Visit(func(f *flag.Flag) { | ||
switch f.Name { | ||
case deprecatedFlagProgOnly: | ||
logger.Println("The -prog_only flag is deprecated and has no effect.", resetColorPostfix) | ||
case deprecatedFlagExecOnly: | ||
logger.Println("The -exec_only flag is deprecated and has no effect.", resetColorPostfix) | ||
} | ||
}) | ||
} | ||
|
||
func initWarningLogger() *log.Logger { | ||
const ( | ||
yellowColor = "\033[33m" | ||
warningPrefix = yellowColor + "WARNING: " | ||
) | ||
|
||
return log.New(os.Stdout, warningPrefix, log.Ldate|log.Ltime) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package build_flags | ||
|
||
// one build flag | ||
//go:generate mockgen -destination=mock1/interfaces_mock.go -build_flags=-tags=tag1 . Interface | ||
// multiple build flags | ||
//go:generate mockgen -destination=mock2/interfaces_mock.go "-build_flags=-race -tags=tag2" . Interface |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//go:build tag1 | ||
|
||
package build_flags | ||
|
||
type Interface interface { | ||
HelloWorld() string | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//go:build tag2 | ||
|
||
package build_flags | ||
|
||
type Interface interface { | ||
Foo() | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep these lines now since we are keeping the flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, i forgot to do this