-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Better lint and test for devs and Makefile cleanup.
This change does several things all towards the end of making it easier for developers to run tests and lint on go code. Now a developer can run either 'make go-test' or 'make lint' without having lots of C dependencies or running in a specific container or stacker. Things changed: * Add a build tag 'skipembed' that builds without needing cmd/stacker/lxc-wrapper/lxc-wrapper . This allows you to build (or test) without that file. In order to ensure that you do not get very far trying to run a 'stacker' binary, I've added a 'panic' if stacker binary is built with skipembed. * Add download-tools target to makefile to ease in downloading of regctl and zot. * Move the downloading of golangci-lint from the github workflow to Makefile. This makes it easier for developer to get it. It is also added to the 'download-tools' target. * be specific about the version of golangci-lint that is used. 1.54.2. golangci-lint's docs specifically say to do this: > IMPORTANT: It's highly recommended installing a specific version > of golangci-lint available on the releases page. changing it is simply a matter of changing the value in the makefile. * Move running of 'go test' out of the lint target to its own 'go-test' target. go-test target will now write a coverage.html so you can view coverage easily. * add 'dlbin' makefile "function" for downloading binaries, and use that for regctl and zot from their rules. * rename TOOLS_DIR to TOOLS_D (consistency with BUILD_D, and just shorter) * move coverage.txt output from test to hack/coverage.txt for easier git-ignoring. Signed-off-by: Scott Moser <smoser@brickies.net>
- Loading branch information
Showing
6 changed files
with
57 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
/stacker-dynamic | ||
.build | ||
|
||
hack/ | ||
|
||
# IDEs | ||
.vscode | ||
.idea |
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,10 @@ | ||
//go:build !skipembed | ||
|
||
package main | ||
|
||
import "embed" | ||
|
||
//go:embed lxc-wrapper/lxc-wrapper | ||
var embeddedFS embed.FS | ||
|
||
const hasEmbedded = true |
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 @@ | ||
//go:build skipembed | ||
|
||
package main | ||
|
||
import "embed" | ||
|
||
var embeddedFS embed.FS | ||
|
||
const hasEmbedded = true |