-
Notifications
You must be signed in to change notification settings - Fork 374
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
chore(make): disable cgo, reorganise makefiles #1715
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1715 +/- ##
==========================================
- Coverage 47.41% 44.72% -2.70%
==========================================
Files 384 456 +72
Lines 61240 67534 +6294
==========================================
+ Hits 29040 30202 +1162
- Misses 29771 34806 +5035
- Partials 2429 2526 +97 ☔ View full report in Codecov by Sentry. |
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.
Looks great 💯
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 generally don't like adding export
to a Makefile because they can bring some side effects (In this case, setting CGO_ENABLED
can also affect go run
for example)
But I don't see any other convenient way to do this for now.
@gfanton I don't see that as a negative :) (I dislike CGO so much that |
This PR sets `CGO_ENABLED=0` in all top-level makefiles. This comes as a consequence of a rare occurrence where [bft is actually failing for a valid reason](https://github.com/gnolang/gno/actions/runs/8111419409/job/22170651604). This is the relevant part of the logs: ``` 2024-03-01T12:36:50.7818357Z ok github.com/gnolang/gno/tm2/pkg/bft/rpc/lib/types 0.004s coverage: 33.3% of statements 2024-03-01T12:36:50.7853384Z github.com/gnolang/gno/tm2/pkg/bft/rpc/test coverage: 0.0% of statements 2024-03-01T12:36:51.5524659Z # github.com/jmhodges/levigo 2024-03-01T12:36:51.5556601Z ##[error]../../../../go/pkg/mod/github.com/jmhodges/levigo@v1.0.0/batch.go:4:11: fatal error: leveldb/c.h: No such file or directory 2024-03-01T12:36:51.5567246Z 4 | // #include "leveldb/c.h" 2024-03-01T12:36:51.5567886Z | ^~~~~~~~~~~~~ 2024-03-01T12:36:51.5568424Z compilation terminated. 2024-03-01T12:36:59.3179828Z FAIL github.com/gnolang/gno/tm2/pkg/bft/state [build failed] ``` This is likely a consequence of gnolang#1602. I've additionally made it so that `bft/state` doesn't require any database it doesn't need in its tests, but personally I have been repeatedly bitten by finding out CGO was enabled and compiling in unexpected places (including the Go stdlib) that I think it makes sense to keep it disabled by default in our makefiles. This PR tackles that, and takes the chance to re-organise the overall structure of makefiles to document prominently the available variables that can be changed.
is /gno/Makefile included? I encountered a similar problem that led to the failure of the golangci-lint installation on my Mac with M2 chip(not sure it's related). |
This PR sets
CGO_ENABLED=0
in all top-level makefiles. This comes as a consequence of a rare occurrence where bft is actually failing for a valid reason. This is the relevant part of the logs:This is likely a consequence of #1602. I've additionally made it so that
bft/state
doesn't require any database it doesn't need in its tests, but personally I have been repeatedly bitten by finding out CGO was enabled and compiling in unexpected places (including the Go stdlib) that I think it makes sense to keep it disabled by default in our makefiles.This PR tackles that, and takes the chance to re-organise the overall structure of makefiles to document prominently the available variables that can be changed.