-
Notifications
You must be signed in to change notification settings - Fork 373
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
feat: add gnoutil, centralizing pkg/file matching #1299
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1299 +/- ##
==========================================
+ Coverage 47.78% 47.98% +0.20%
==========================================
Files 369 370 +1
Lines 62702 62791 +89
==========================================
+ Hits 29963 30132 +169
+ Misses 30303 30215 -88
- Partials 2436 2444 +8
☔ View full report in Codecov by Sentry. |
@@ -159,7 +159,7 @@ func InitChainer(baseApp *sdk.BaseApp, acctKpr auth.AccountKeeperI, bankKpr bank | |||
|
|||
// NOTE: comment out to ignore. | |||
if !skipFailingGenesisTxs { | |||
panic(res.Error) | |||
panic(res.Log) |
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.
slipping in by accident as most errors here, if we just get res.Error, tend to be internal error
. if we feel like we need to discuss it, happy to do another PR.
"github.com/gnolang/gno/tm2/pkg/commands" | ||
) | ||
|
||
type buildCfg struct { | ||
verbose bool | ||
goBinary string |
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 the option to specify a gno file as:
- this is inconsistent with the rest of
guessRootDir
, which just use "go" as an argument. - it is already fairly straightforward to change this in a script; just change your
PATH
.
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.
some changing behaviour for this and the following tests: passing .
as an argument to gno build is no longer recursive, the simple solution is to use ...
.
a side effect is that the paths that we return are going to be "simplified" from the input, which is what happens in this and some other files.
// no go/gno tests. disable ellipsis (must be exactly 1 package or file). | ||
gnoutil.MatchFiles(`*.go`, `!/_(file)?test\.{go,gno\.gen\.go}$/`), | ||
gnoutil.MatchEllipsis(false), | ||
gnoutil.MatchNoImplicit(), |
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 possibly stretching the scope a bit (as here we're working on Go files), but given the amount of lines this removes I thought it would still be a good idea.
} | ||
} | ||
|
||
sort.Strings(files) |
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.
(fs.ReadDir is alphabetical by default, no need to re-sort this)
subPkg.Dir = firstDir | ||
|
||
return &subPkg, nil | ||
} |
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.
(all of this just feels needlessly complex and duplicated logic)
This is good for a first review by anyone, but I realised that this PR is missing |
Current state: This PR is useful, but needs a better name, and a refactor. Ultimately, this is a package that aims to centralise all functionality related to import paths, and resolving an import path to corresponding directories and go files. Seeing as Go has a notion of "importer", we can likely call it that. Detecting the gno root directory should also finish its centralization, but it should remain where it is in Seeing as #1702 adds an importer already, which would benefit to be moved into this new It should also ensure to fix the underlying bug in #1306 -- ie. #1142. |
Acting on my comment from a few weeks ago.
This PR introduces a new package,
gnoutil
, intended as a utility package for dealing with Gno files. Fixes #1056.The most useful and crucial part of its exported functions is
Match
, which provides a versatile system for matching gno files in the filesystem. It supersedesgnovm/cmd/gno/util.gno
's functions, like gnoPackagesFromArgs or targetsFromPatterns.I didn't succeed in my intent of having more lines removed than added, but I think if you remove the affected test files, then it should be the case :)
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description