Skip to content

Commit 5439316

Browse files
authored
Local watch script (#1304)
* local watch script for building troubleshoot
1 parent d730be0 commit 5439316

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ To get started we recommend:
3232
3333
6. Install [golangci-lint] linter and run `make lint` to execute additional code linters.
3434

35+
### Build automatically on save with `watch`
36+
37+
1. Install `npm`
38+
2. Run `make watch` to build binaries automatically on saving. Note: you may still have to run `make schemas` if you've added API changes, like a new collector or analyzer type.
39+
3540
### Syncing to a test cluster with `watchrsync`
3641

3742
1. Install `npm`

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ lint: fmt vet
240240
lint-and-fix: fmt vet
241241
golangci-lint run --new --fix -c .golangci.yaml ${BUILDPATHS}
242242

243+
.PHONY: watch
244+
watch: npm-install
245+
bin/watch.js
246+
243247
## Syncronize the code with a remote server. More info: CONTRIBUTING.md
244248
.PHONY: watchrsync
245249
watchrsync: npm-install

bin/watch.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env node
2+
3+
const gri = require('gaze-run-interrupt');
4+
5+
const binList = [
6+
// 'bin/analyze',
7+
// 'bin/preflight',
8+
'bin/support-bundle',
9+
// 'bin/collect'
10+
]
11+
const makeList = [
12+
// 'analyze',
13+
// 'preflight',
14+
'support-bundle',
15+
// 'collect'
16+
]
17+
18+
const commands = [
19+
// {
20+
// command: 'rm',
21+
// args: binList,
22+
// },
23+
{
24+
command: 'make',
25+
args: makeList,
26+
},
27+
];
28+
29+
commands.push({
30+
command: "date",
31+
args: [],
32+
});
33+
34+
commands.push({
35+
command: "echo",
36+
args: ["synced"],
37+
});
38+
39+
gri([
40+
'cmd/**/*.go',
41+
'pkg/**/*.go',
42+
], commands);

0 commit comments

Comments
 (0)