-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
go gen improvements #524
go gen improvements #524
Conversation
@bwaz I'm still fuzzy on why this 'go gen' needs to be called twice. Why is that? |
Codecov Report
@@ Coverage Diff @@
## master #524 +/- ##
=======================================
Coverage 38.88% 38.88%
=======================================
Files 120 120
Lines 5995 5995
=======================================
Hits 2331 2331
Misses 3479 3479
Partials 185 185
Continue to review full report at Codecov.
|
go generate will provide the path and package name that where it was called from. So if the package layout changes the generated files will change package name and location path as well. The imports and directives need to parse the same config file to provide output for each use. |
So the changes I've just pushed, will make |
Makefile
Outdated
@@ -50,7 +50,7 @@ clean: | |||
|
|||
.PHONY: gen | |||
gen: | |||
go generate ./core/... | |||
go generate |
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.
make sure this actually will generate the z files; delete them first and retry.
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.
I've tried go generate ./...
however this caused issues with vendor code - you could for now just explicitly generate the coredns.go
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.
done. Listed coredns.go
explicitly.
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.
also removed the z* files and go genned - that works.
directives_generate.go
Outdated
} | ||
} | ||
|
||
var orders []int |
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.
This is unused and redundant what is in the func.... I missed this earlier.
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.
removed.
Remove the "gen" directory and move directives_generate.go out of it. Add a build ignore tag so it isn't build by default. Cleanup the go gen invocations so there are not seen as package docs. Simplify the code a bit and don't run go gen twice.
Remove the "gen" directory and move directives_generate.go out of it.
Add a build ignore tag so it isn't build by default. Cleanup the go ge
invocations so there are not seen as package docs.