3
3
4
4
Instant, easy, and predictable development environments
5
5
6
- ## Scripts
6
+ ## Getting Started
7
+ This project uses [ devbox] ( https://github.com/jetpack-io/devbox ) to manage its development environment.
8
+
9
+ Install devbox:
10
+ ``` sh
11
+ curl -fsSL https://get.jetpack.io/devbox | bash
12
+ ```
7
13
8
- * [ build] ( #build )
9
- * [ build-all] ( #build-all )
10
- * [ build-darwin-amd64] ( #build-darwin-amd64 )
11
- * [ build-darwin-arm64] ( #build-darwin-arm64 )
12
- * [ build-linux-amd64] ( #build-linux-amd64 )
13
- * [ build-linux-arm64] ( #build-linux-arm64 )
14
- * [ code] ( #code )
15
- * [ fmt] ( #fmt )
16
- * [ lint] ( #lint )
17
- * [ test] ( #test )
18
- * [ tidy] ( #tidy )
19
- * [ update-examples] ( #update-examples )
20
-
21
- ## Init Hook
14
+ Start the devbox shell:
15
+ ``` sh
16
+ devbox shell
17
+ ```
22
18
19
+ Run a script in the devbox environment:
20
+ ``` sh
21
+ devbox run < script>
22
+ ```
23
+ ## Scripts
24
+ Scripts are custom commands that can be run using this project's environment. This project has the following scripts:
25
+
26
+ * [ build] ( #devbox-run-build )
27
+ * [ build-all] ( #devbox-run-build-all )
28
+ * [ build-darwin-amd64] ( #devbox-run-build-darwin-amd64 )
29
+ * [ build-darwin-arm64] ( #devbox-run-build-darwin-arm64 )
30
+ * [ build-linux-amd64] ( #devbox-run-build-linux-amd64 )
31
+ * [ build-linux-arm64] ( #devbox-run-build-linux-arm64 )
32
+ * [ code] ( #devbox-run-code )
33
+ * [ fmt] ( #devbox-run-fmt )
34
+ * [ lint] ( #devbox-run-lint )
35
+ * [ test] ( #devbox-run-test )
36
+ * [ tidy] ( #devbox-run-tidy )
37
+ * [ update-examples] ( #devbox-run-update-examples )
38
+
39
+ ## Shell Init Hook
40
+ The Shell Init Hook is a script that runs whenever the devbox environment is instantiated. It runs
41
+ on ` devbox shell ` and on ` devbox run ` .
23
42
``` sh
24
43
test -z $FISH_VERSION && unset CGO_ENABLED GO111MODULE GOARCH GOFLAGS GOMOD GOOS GOROOT GOTOOLCHAIN GOWORK
25
44
```
@@ -29,74 +48,85 @@ test -z $FISH_VERSION && unset CGO_ENABLED GO111MODULE GOARCH GOFLAGS GOMOD GOOS
29
48
* [ go@latest] ( https://www.nixhub.io/packages/go )
30
49
* [ runx: golangci /golangci-lint@latest] ( https://www.github.com/golangci/golangci-lint )
31
50
* [ runx: mvdan /gofumpt@latest] ( https://www.github.com/mvdan/gofumpt )
32
- * nixpkgs/63143ac2c9186be6d9da6035fa22620018c85932#hello
33
51
34
52
## Script Details
35
53
36
- ### build
54
+ ### devbox run build
37
55
Build devbox for the current platform
38
56
``` sh
39
57
go build -o dist/devbox ./cmd/devbox
40
58
```
59
+ &ensp ;
41
60
42
- ### build-all
61
+ ### devbox run build-all
43
62
``` sh
44
63
devbox run build-darwin-amd64
45
64
devbox run build-darwin-arm64
46
65
devbox run build-linux-amd64
47
66
devbox run build-linux-arm64
48
67
```
68
+ &ensp ;
49
69
50
- ### build-darwin-amd64
70
+ ### devbox run build-darwin-amd64
51
71
``` sh
52
72
GOOS=darwin GOARCH=amd64 go build -o dist/devbox-darwin-amd64 ./cmd/devbox
53
73
```
74
+ &ensp ;
54
75
55
- ### build-darwin-arm64
76
+ ### devbox run build-darwin-arm64
56
77
``` sh
57
78
GOOS=darwin GOARCH=arm64 go build -o dist/devbox-darwin-arm64 ./cmd/devbox
58
79
```
80
+ &ensp ;
59
81
60
- ### build-linux-amd64
82
+ ### devbox run build-linux-amd64
61
83
``` sh
62
84
GOOS=linux GOARCH=amd64 go build -o dist/devbox-linux-amd64 ./cmd/devbox
63
85
```
86
+ &ensp ;
64
87
65
- ### build-linux-arm64
88
+ ### devbox run build-linux-arm64
66
89
``` sh
67
90
GOOS=linux GOARCH=arm64 go build -o dist/devbox-linux-arm64 ./cmd/devbox
68
91
```
92
+ &ensp ;
69
93
70
- ### code
94
+ ### devbox run code
71
95
Open VSCode
72
96
``` sh
73
97
code .
74
98
```
99
+ &ensp ;
75
100
76
- ### fmt
101
+ ### devbox run fmt
77
102
``` sh
78
103
scripts/gofumpt.sh
79
104
```
105
+ &ensp ;
80
106
81
- ### lint
107
+ ### devbox run lint
82
108
``` sh
83
109
golangci-lint run --timeout 5m && scripts/gofumpt.sh
84
110
```
111
+ &ensp ;
85
112
86
- ### test
113
+ ### devbox run test
87
114
``` sh
88
115
go test -race -cover ./...
89
116
```
117
+ &ensp ;
90
118
91
- ### tidy
119
+ ### devbox run tidy
92
120
``` sh
93
121
go mod tidy
94
122
```
123
+ &ensp ;
95
124
96
- ### update-examples
125
+ ### devbox run update-examples
97
126
``` sh
98
127
devbox run build && go run testscripts/testrunner/updater/main.go
99
128
```
129
+ &ensp ;
100
130
101
131
102
132
0 commit comments