You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will ensure that any changes you commit locally pass a basic sanity
156
-
check. Using pre-push requires git 1.8.2 or later, though alternatively
157
-
running the check as a pre-commit hook also works.
158
-
159
121
Staying in sync
160
122
---------------
161
123
@@ -169,30 +131,28 @@ git pull upstream
169
131
Dependency management
170
132
=====================
171
133
172
-
In the top-level directory of the Juju repo, there is a file,
173
-
[go.mod](go.mod), that holds the versions of all the external
174
-
Go modules that Juju depends on. That file is used to freeze the code in
175
-
external repositories so that Juju is insulated from changes to those repos.
176
-
177
134
go mod
178
135
------
179
136
180
-
Juju uses Go modules to manage dependencies. Your Go installation will ensure
181
-
you are building with the correct version - you don't need to do anything.
137
+
Juju uses Go modules to manage dependencies.
182
138
183
139
Updating dependencies
184
140
---------------------
185
141
186
-
To update a dependency, use
142
+
To update a dependency, use the following, ensuring that the dependency is
143
+
using a version where possible, or a commit hash if not available:
144
+
145
+
187
146
```
188
-
go get -u github.com/the/dependency
147
+
go get -u github.com/the/dependency@v1.2.3
189
148
go mod tidy
190
149
```
191
150
192
151
Code formatting
193
152
===============
194
153
195
-
Go provides a tool, `go fmt`, which facilitates a standardized format to go source code. The Juju project has one additional policy:
154
+
Go provides a tool, `go fmt`, which facilitates a standardized format to go
155
+
source code. The Juju project has one additional policy:
196
156
197
157
Imports
198
158
-------
@@ -215,9 +175,6 @@ group is alphabetically sorted. eg:
215
175
)
216
176
```
217
177
218
-
Because "gopkg.in/check.v1" will be referenced frequently in test suites, its
219
-
name gets a default short name of just "gc".
220
-
221
178
Workflow
222
179
========
223
180
@@ -242,7 +199,7 @@ and so we keep a separate Git branch for each version. When submitting a
242
199
patch, please make sure your changes are targeted to the correct branch.
243
200
244
201
We keep a branch for each minor version of Juju in active development (e.g.
245
-
`2.9`, `3.1`) - bug fixes should go into the relevant branch. We also keep a
202
+
`3.4`, `3.5`) - bug fixes should go into the relevant branch. We also keep a
246
203
`main` branch, which will become the next minor version of Juju. All new
247
204
features should go into `main`.
248
205
@@ -256,6 +213,7 @@ Creating a new branch
256
213
All development should be done on a new branch, based on the correct branch
257
214
determined above. Pull the latest version of this branch, then create and
258
215
checkout a new branch for your changes - e.g. for a patch targeting `main`:
216
+
259
217
```
260
218
git pull upstream main
261
219
git checkout -b new_feature main
@@ -318,10 +276,18 @@ Testing and MongoDB
318
276
-------------------
319
277
320
278
Many tests use a standalone instance of `mongod` as part of their setup. The
321
-
`mongod` binary found in `$PATH` is executed by these suites. If you don't already have MongoDB installed, or have difficulty using your installed version to run Juju tests, you may want to install the [`juju-db` snap](https://snapcraft.io/juju-db), which is guaranteed to work with Juju.
279
+
`mongod` binary found in `$PATH` is executed by these suites. If you don't
280
+
already have MongoDB installed, or have difficulty using your installed version
281
+
to run Juju tests, you may want to install the [`juju-db` snap](https://snapcraft.io/juju-db), which is guaranteed to work with Juju.
322
282
323
283
```bash
324
284
sudo snap install juju-db --channel 4.4/stable
285
+
```
286
+
287
+
Optionally, you can create aliases for `mongod` and `mongo` to make it easier to
288
+
use the snap version:
289
+
290
+
```bash
325
291
sudo snap alias juju-db.mongod mongod
326
292
sudo snap alias juju-db.mongo mongo
327
293
```
@@ -442,12 +408,7 @@ Required dependencies for full static analysis are:
0 commit comments